#i'm a cyborg but that's okay
1 messages · Page 1 of 1 (latest)
Hi, yes - you'd want to use our Subscriptions Schedules API, https://stripe.com/docs/api/subscription_schedules
You'd add different phases. For the first phase, they'd stay on plan 3 then the seconds phase, plan 2 starts after the previous phase ends.
so, when a user initially subscribes to a plan using checkout, i'll get a subscription id. And, when they change their plan, I'll use the existing subscription_id to create a schedule.
Does creating a new schedule kind of invalidates the existing subscription_id? Do I have to store this new subscription schedule ID somewhere in my database?
You're right. The subscription is created from your checkout, and you pass the subscription id to start the subscription schedules by passing the from_subscription, https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-from_subscription
Does creating a new schedule kind of invalidates the existing subscription_id? Do I have to store this new subscription schedule ID somewhere in my database?
The guide doesn't addresses these questions :(
What does 'invalidate' mean? You should be able to see the subscription id
Does subscription_id remains the same for a particular customer even if they change their plan?
the subscription id will remain the same, and you'll get a subscription schedule id: https://stripe.com/docs/api/subscription_schedules/object.
alright. One more thing, if I create a subscription schedule, but then like I said in the upgrade scenario, when a user tries to upgrade, i'll upgrade the user immediately.
For this, I'll have to release a subscription schedule, and generate an invoice immediately, right?
I don't think I'll need to cancel a schedule, because that would cancel the existing subscription as well.
You do not want to cancel the schedule, rather add a new phase to the schedule by using the Update Subscription Schedule API: https://stripe.com/docs/api/subscription_schedules/update
cool.
So, here's the complete flow. Please correct me if something is wrong.
User subscribes for a first time -> Stripe checkout -> Subscription is created
User changes plan(upgrade) -> Create a subscription schedule using existing subscription id with invoice immediately(removing any phases before)
User changes plan(downgrade) -> Create/modify subscription schedule adding a new phase(removing any phases before except the ongoing plan)
That's it.
What do you mean by 'removing any phases before'? You wouldn't remove a phase
so, lets say a user is on plan 3, and they chose to downgrade to plan 2. I won't let them downgrade immediately, instead schedule plan 2 to take effect after the current plan 3 ends. In this case, my phase would contain step for plan 2.
However, before plan 2 takes place, user chooses to downgrade to plan 1 instead, so in this case I'll have to remove previous plan 2 step, and add in step for plan 1.
So, i'm guessing i'll have to remove the plan 2 phase, and add in plan 1 phase, right?
I see, yes -- you'd want to test this in your test enviroment first to make sure that it's doing everything that you intent id to do.
Cool, i'll test this. Thanks a lot for your help!