#Vineet-Checkout
1 messages · Page 1 of 1 (latest)
Hello, what you want to achieve with proration is possible and it is built in by our Subscription Upgrade API. I just want to understand more about the part
But I see there is a problem with this approach that every time user is upgrading or downgrading the plan, stripe checkout api internally creates new subscription so user end up with multiple subscription which should not be the case
What do you mean by this? How your customer upgrading or downgrading the plan? Where do you see Stripe Checkout API "internally creates new Subscription"?
we have option to switch between plans in the frontend so let's suppose you have choosen one plan and clicks on buy, then I make an api call to create the customer if not created followed by this api stripe.checkout.Session.createwhich creates a checkout link and user redirects to the checkout page and once that payment is completed I see a new subscription is created. But let's suppose user wants to upgrade the plan then above steps again performed at our backend and we don't have option to pass existing subscription to this stripe.checkout.Session.create
or may be I am doing something wrong here but I didn't see any example like this
That's the place for Customer Portal
You create a different thing called "Customer Portal Session", and present to your customer, let them manage Subscription there
Yeah I created this but I wanted to know any solution which we can implement within our UI (avoiding user to go the customer portal and upgrade the plan from there)
we show packages list within our application and when user clicks on upgrade page and I send them to the stripe customer portal where he has to again click on the upgrade button which I think is not good user experience
So wondering if there is any way I can achieve this from our UI
Ah I see
I think you can use your UI and completely control the Subscription through Stripe API on your server. Technically it's about separating Change UI and logic
Here is the API to update Subscription: https://stripe.com/docs/api/subscriptions/update
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
It also document the proration behavior
yeah I saw this as well but I don't understand one thing:-
We want to charge the customer immediately so if I update the subscription (till this time customer did not pay the difference) how can I send him to checkout page again for the difference amount or will it be deducted automatically ??
so to achieve this I do the stripe.checkout.Session.create this api call again but unfortunately it generates the new subscription
because I do not see a way to pass subscription id as a param
It should be deducted automatically,
If it doesn't you can check if your Customer object has the PaymentMethod set as default payment method or not
cool I will check one last question here: what if there is no default payment method
Hmm could you try to see how it goes?
sure thanks
I think it should automatically deduct based on the PaymentMethod that used last time