1

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.

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

Alternatives:

  • 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.

Bugra
  • 189
  • 2
  • 14

2 Answers2

3

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.

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

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.

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

Bugra
  • 189
  • 2
  • 14
2

So you want to update the subscription details at the end of the current period. In that case, you may want to use the subscription webhook events mentioned here

"When the subscription period elapses, invoice.created event is sent, indicating the creation of a draft invoice."

"About an hour after the invoice is created, it is finalized (changes are no longer permitted), and an invoice.finalized event is sent."

So you can listen to that invoice.created event and then update the subscription.

Imtiaz Sakib
  • 1,231
  • 11
  • 8