Stripe 订阅:在周期结束时修改而不是现在 [英] Stripe subscriptions: Modify when period ends instead of now

查看:52
本文介绍了Stripe 订阅:在周期结束时修改而不是现在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文:有一个 Stripe 计划入门".客户订阅入门"计划.在订阅期内,用户想要升级或降级订阅(在我的情况下:数量将增加或减少).我想以编程方式通过订阅更新来实现这一点.

Context: There is a Stripe plan "Starter". The customer subscribes to the "Starter" plan. Within a subscription period the user wants to up- or downgrade the subscription (in my case: the quantity will be increased or decreased). Programmatically I want to achieve this with a subscription update.

问题:Stripe 希望立即进行更新.但我想在期末改变它.

Problem: Stripe wants to make the update immediately. But I want to have it changed at the end of the period.

替代方案:

  • 我看到这个 Stackoverflow 提出了完全相同的问题,但是是六年前 -> 条纹:在期末"降级用户.提议的解决方案并未真正反映所需的解决方案,也不适合我.
  • 我看到 Stripe 有一个订阅计划 API.这可能与问题解决方案有关吗?
  • I saw this Stackoverflow asking exact the same question, but is six years ago -> Stripe: downgrade a user at "period end". The proposed solutions are not really reflecting the desired solution and also do not work for me.
  • I saw that Stripe has a subscription schedule API. Is this probably related to the problem solution?

我非常期待(高级)解决方案来解决这个问题.提前致谢.

I'm relly looking forward for (high-level) solutions to solve this problem. Thank you in advance.

推荐答案

这是我与 Stripe 支持频道讨论的内容:

This is what I discussed with the Stripe support channel:

我了解日程安排并不适合您,因为您会更新完成后必须发布时间表,以便新的订阅滚动,这不会取消订阅,但是开始一个新的.

I understand that scheduling is not the best fit for you, as you'd have to release the schedule once the update is made so the new subscription rolls over, and this doesn't cancel the subscription, but start a new one.

你可以做的是在_period_end取消第一个订阅,然后在事件发生时开始下一个customer.subscription.deleted 通过:https://stripe.com/docs/api/events/types#event_types-customer.subscription.deleted

What you could do, is to cancel the first subscription at_period_end, and then start the next one when the event customer.subscription.deleted comes through: https://stripe.com/docs/api/events/types#event_types-customer.subscription.deleted

如果不想使用Webhooks,也可以在期末取消然后同时使用计费周期锚点https://stripe.com/docs/api/subscriptions/create#create_subscription-billing_cycle_anchor.这仅适用于具有相同间隔的订阅,或者如果第二个订阅间隔比第一个短.

If you don't want to use Webhooks, you can also cancel at period end and then generate the new subscription at the same time using the billing cycle anchor https://stripe.com/docs/api/subscriptions/create#create_subscription-billing_cycle_anchor. This will only work though for subscriptions with the same interval, or if the second subscription interval is shorter than the first.

我实施了 webhook 解决方案.它非常适合我.

I implemented the webhook solution. It works perfectly for me.

这篇关于Stripe 订阅:在周期结束时修改而不是现在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆