[英]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: 到目前为止我考虑的解决方案:
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.