Stripe:Expire/Cancel 次付款后订阅
Stripe: Expire/Cancel subscription after n payments
在我们的应用中,我们为用户创建订阅,效果很好,订阅可能因计划类型而异。但是我不知道如何在用户全额付款后取消订阅。
在创建订阅时我们是否可以告诉 stripe 任何参数,告诉它什么时候应该取消订阅或者告诉它在 n
次付款后取消它?
基本上,如果客户购买了价值 1000 的产品,我们会每月向他收取 100,但一旦他全额付款,我们就会自动取消订阅。
感谢帮助
当您在 Stripe 中创建订阅时,无法告诉 Stripe 在 N 个月后或达到给定金额时停止订阅。
By default, a subscription continues, and the customer continues to be
billed, until it’s canceled
所以您可以做的是在满足给定条件后取消订阅。
您可以使用 webhooks 在每个结算周期结束时,使用 invoice.payment_succeeded
事件(文档 here).
您可以通过某种方式在您的数据库中跟踪客户支付的总金额,以及在您出售商品之前剩余的金额 "fully paid"。
每次获得网络钩子时,您都会增加总额,如果达到所需金额,您会取消订阅,这样下个月就不会向客户收费。
我在这里回答:Stripe cancel subscription at specific date
Stripe just added this to their API and I happened to stumble upon it. They have a field called "cancel_at" that can be set to a date in the future. They don't have this attribute listed in their documentation since it is so new. You can see the value in the response object here:
https://stripe.com/docs/api/subscriptions/create?lang=php
I've tested this using .NET and can confirm it sets the subscription to expire at value you provide.
在我们的应用中,我们为用户创建订阅,效果很好,订阅可能因计划类型而异。但是我不知道如何在用户全额付款后取消订阅。
在创建订阅时我们是否可以告诉 stripe 任何参数,告诉它什么时候应该取消订阅或者告诉它在 n
次付款后取消它?
基本上,如果客户购买了价值 1000 的产品,我们会每月向他收取 100,但一旦他全额付款,我们就会自动取消订阅。
感谢帮助
当您在 Stripe 中创建订阅时,无法告诉 Stripe 在 N 个月后或达到给定金额时停止订阅。
By default, a subscription continues, and the customer continues to be billed, until it’s canceled
所以您可以做的是在满足给定条件后取消订阅。
您可以使用 webhooks 在每个结算周期结束时,使用 invoice.payment_succeeded
事件(文档 here).
您可以通过某种方式在您的数据库中跟踪客户支付的总金额,以及在您出售商品之前剩余的金额 "fully paid"。
每次获得网络钩子时,您都会增加总额,如果达到所需金额,您会取消订阅,这样下个月就不会向客户收费。
我在这里回答:Stripe cancel subscription at specific date
Stripe just added this to their API and I happened to stumble upon it. They have a field called "cancel_at" that can be set to a date in the future. They don't have this attribute listed in their documentation since it is so new. You can see the value in the response object here:
https://stripe.com/docs/api/subscriptions/create?lang=php
I've tested this using .NET and can confirm it sets the subscription to expire at value you provide.