#tareqpi
1 messages · Page 1 of 1 (latest)
You can't change an existing Subscription via Checkout Session. Probably you meant Billing Portal?
The user can update his existing subscription via the billing portal. But in the scenario where he accesses the checkout session to switch his plan, instead of using the billing portal for some reason, I want to enable proration for him.
Currently, I have implemented logic where if the customer has an existing subscription then it gets canceled and it is replaced by the new one. Is there a way to calculate the proration of the old subscription and use it as a one-time discount/account credit depending if it is an upgrade/downgrade scenario?
You can cancel the existing subscription with proration and immediately invoice. The prorated amount will be credited to the customer balance and will be automatically applied to the next invoice.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
is that what you're looking for?