#Wik-subscription-trials
1 messages ยท Page 1 of 1 (latest)
Hey there!
The default Stripe behaviour with trials would be to continue onto the regular billing cycle of the specified Price object unless canceled/removed from the subscription
What determines whether they stay on plan A or plan B?
Our product team wanted them to be able to go back to their previous plan (A) by default ( case 2) once their subscription ends. Is it possible?
The user might choose to stay on the trial, I know how to handle that, I'm only wondering about putting them back onto the previous plan.
The confusing part of your question is that both scenarios were 'by default' ๐
You'd need to handle that yourself: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
There's no automated flow for that
The confusing part of your question is that both scenarios were 'by default' ๐
Ah, yes, sorry. I meant it as two separate scenarios with different default behaviour ๐
Ok, got it. Does that help clarify what you need to do?
I imagine you'd listen to the customer.subscription.trial_will_end event and in your webhook handler make the necessary call to update the related subscription
You'd need to handle that yourself
Got it. Let's say that I upgraded the user's subscription to start the trial for them (plan A => plan B), when I want to downgrade them to the old plan, does Stripe keep any record of the previous plan? Or is it on me to record their previous plan id in my db?
What in this case is the 'plan'?
Product. Apologies plan is the term we use in our app.
What does that correlate to in Stripe? A Price object?
Not sure if I understand the question. In the dashboard, when I look at a subscription it has products and plan A is listed there.
Can you share a specific Subscription ID?
Can it be from a test mode?
Sure
Great. Can you give me a sec? I'll prepare it.
Subscription id: sub_1KLnSMJA8pMPzFjl5bMUBdZT
Yeah, so you're using Price objects (which is the object that determines the billing period, cost, etc): https://dashboard.stripe.com/test/prices/yearly-2500usd-team-20211029
So when you come to downgrade them, you'd just use that price_xxx ID when making the update call to the existing subscription
Yes, is there any way I can get their previous price from Stripe or do I have to store it in my db? E.g. the subscription object in the db only has one price but two invoices and the first invoice mentions the original price.
There'd be no reference to the Price object so you'd need to persist that somewhere yes
Thank you for confirming (and working with me through this, it evolved into a long thread!).
Last question: for a trial subscription, if I set cancel_at_period_end, will it cancel the trial at its end or will it move trial to active and cancel at subscription end?
e.g. user started trial of a yearly plan on 1st June. Trial lasts 14 days. Setting cancel_at_period_end will cause the subscription to be cancelled on 15th June or 1st June next year?
Hmm, not sure. Let me test
Just created a new subscription with a monthly plan, with a 7 day trial. current_period_end is 1643717022 which is a week from now (Tue Feb 01 2022 12:03:42 GMT+0000)
So based on that I think it'll cancel at the end of the trial before the 1 year billing period starts
A thousand thank yous! Thank you for your time and help, have a lovely day.
Np!