#HugoRS
1 messages · Page 1 of 1 (latest)
Hi there
You basically let us do this for you.
Are you asking how to calculate ahead of time?
Alright, thats a release
Yes. For our own checkout
I'm using the Retrieve the subscription api to get the users current plan
And then I'm using the Retrieve a price API for the new subscription
Is this the way
If you want to know what the proration will be ahead of actually making the update then you want to use the Upcoming Invoice API: https://stripe.com/docs/api/invoices/upcoming
But can I use the upcoming invoice api before switching the subscription plan?
Yep
Take a read through what it says there in the API Ref for how that endpoint works
Thanks, I will have to send the new subscription id here, but the subscription is not yet created, right?
Well if you are previewing an update then the Subscription has been created? Otherwise you can also preview the initial invoice for a new Subscription before creating it
But right now i'm only using the update subscription API and this will change the users subscription directly (and also create a new subscription id, right?) I want to display the information before the switch.
No updating a Subscription does not create a new Subscription ID
Once a Subscription is created then it will maintain the same Subscription ID throughout its lifecycle
Alright cool, but how does the retrieve an upcoming invoice know what price the new subscription has?
You use the subscription_items parameter to indicate what items you want to add or update.
Now I understand, and where do I grab the subscription_item from?
You would get the current ones by retrieving the Subscription using https://stripe.com/docs/api/subscriptions/retrieve
Alright, thank you!