#i'm a cyborg but that's okay

1 messages ยท Page 1 of 1 (latest)

atomic ibexBOT
magic pendant
chilly turret
#

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.

magic pendant
#

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

chilly turret
#

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.

magic pendant
# chilly turret Also, is there a way to know if changing a plan will either result in downgradin...

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

chilly turret
#

Alright. Thanks a lot for the help ๐Ÿ™‚