#i'm a cyborg but that's okay
1 messages ยท Page 1 of 1 (latest)
๐ Hi there, Happy to help!
When downgrading the subscription, you can set these two params:
proration_behavior=none and billing_cycle_anchor=unchanged
https://stripe.com/docs/api/subscriptions/update#update_subscription-proration_behavior
https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_cycle_anchor
cool, so how would this work?
Like if a customer downgrades(with the changes above), their ongoing subscription will still go on, and when that ends, the new subscription will take place, right?
So, when the new subscription takes place, stripe will attempt to auto-charge user, and if successful, I'll get an invoice.paid event, right?
Just making sure if my thinking is correct or not.
Yes, it should be like that. You can test it using the test mode and Stripe Clocks:
https://stripe.com/docs/testing
https://stripe.com/docs/billing/testing/test-clocks
I did look into subscription schedules, but I'm not sure how to do add a schedule to an existing subscription.
You can do the same thing with subscription schedule also, take a look at this guide:
https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#downgrading-subscriptions
But with more further action for your use case.
You need to create a subscription_schedule from that existing subscription, using this API:
https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-from_subscription
The you update that subscription_schedule, with a new phase that start after the current phase and with the downgraded plan:
https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-phases
Alright, I'll check this out. Thanks a lot.
Also, is there a way to know if changing a plan will either result in downgrading or upgrading through stripe?
Because I have different behaviours depending on whether user is downgrading or upgrading.
Stripe can't know if the subscription update is a downgrade or an update, because it depends on how you design your plans. But you can get notified when a customer's subscription has been updated by listening to this webhook event customer.subscription.updated:
https://stripe.com/docs/api/events/types#event_types-customer.subscription.updated
You need to store the actual subscription plan for each customer in your integration and then compare to the new plan you'll get from the event and judge if it's a downgrade or an upgrade according to your Business
Alright. Thanks a lot for the help ๐