简体   繁体   English

给予条纹客户信用

[英]Giving Stripe Customers Credit

I'm working with Stripe. 我正在使用Stripe。 Our users subscribe to our service and they are billed every 2 weeks. 我们的用户订阅我们的服务,他们每两周收费一次。 We need to implement a way to give them $5 credit every time they refer someone to use our service. 每当他们推荐某人使用我们的服务时,我们需要实施一种方式给他们5美元的信用。

Solutions I have considered so far: 到目前为止我考虑的解决方案:

  • Stripe coupons: Stripe has great documentation. Stripe优惠券:Stripe有很棒的文档。 Unfortunately, for coupons there are many ambiguities. 不幸的是,对于优惠券,存在许多含糊之处。 I tried working with coupons but so far it seems like a coupon can only be applied once for each invoice, and you can't apply multiple coupons for one invoice. 我尝试使用优惠券,但到目前为止,优惠券似乎只能为每张发票申请一次,而且您不能为一张发票申请多张优惠券。 This will not work with us since a user can earn $5 multiple times during the billing period. 这不适用于我们,因为用户可以在结算周期内多次获得5美元。
  • Issuing refund: the problem with this is that we have to pay the user actual money while what we actually want is to give them credit to use in our service. 发放退款:问题在于我们必须向用户支付实际的钱,而我们实际想要的是给予他们在我们的服务中使用的信用。

Am I missing anything with coupons? 我错过了优惠券吗? Are there any other solutions/suggestions? 还有其他解决方案/建议吗?

If I understand your use case correctly, I think the best way would be to create an invoice item with an amount of -500 for each referral. 如果我正确理解您的用例,我认为最好的方法是为每个推介创建一个amount-500 的发票项目 When you create an invoice item, by default it is set as "pending" and will automatically be included in the next invoice, ie at the end of the current billing period. 创建发票项目时,默认情况下会将其设置为“待处理”,并自动包含在下一个发票中,即当前结算周期结束时。

Be aware that if the invoice's total is negative (in the case of many referrals), then the total will be added to the customer's account_balance and reduce the amount of the next invoice as well. 请注意,如果发票的总额为负数(在许多推介的情况下),则总计将添加到客户的account_balance并减少下一个发票的金额。 If this isn't what you want, you'd need to reset the customer's account_balance to zero, or make sure that you don't create invoice items that will make the invoice's total go below zero. 如果这不是您想要的,您需要将客户的account_balance重置为零,或者确保您不创建将使发票总额低于零的发票项目。

More information about invoice items can be found here: https://stripe.com/docs/subscriptions/guide#adding-invoice-items . 有关发票项目的更多信息,请访问: https//stripe.com/docs/subscriptions/guide#adding-invoice-items The guide only mentions invoice items with positive values (ie additional charges), but you can use negative values as well. 本指南仅提及具有正值的发票项目(即附加费用),但您也可以使用负值。

Have you considered just checking for available credit in transactions before you charge? 您是否考虑在收费前检查交易中的可用信用额度?

That way you can just store how much credit people currently have in some database, and just apply the balance on transactions. 这样,您可以只存储人们当前在某些数据库中拥有的信用额度,并仅在交易中应用余额。 AKA charge them for full_price - total_credits . AKA向他们收取full_price - total_credits

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM