I’ve different subscription plan on stripe starting from Zero. When customer sign up, I’m creating a subscription with free plan by default.
In the future, customer want to upgrade the plan through checkout session, how can I pass my existing subscription details to the checkout session to update the plan tagged to the subscription ID instead of creating multiple subscriptions.
I gone through the stripe create checkout session Doc but I couldn’t find a way to pass subscription ID in checkout session.
Any help would be much appreciated
I’ve different subscription plan on stripe starting from Zero. When customer sign up, I’m creating a subscription with free plan by default.
In the future, customer want to upgrade the plan through checkout session, how can I pass my existing subscription details to the checkout session to update the plan tagged to the subscription ID instead of creating multiple subscriptions.
I gone through the stripe create checkout session Doc but I couldn’t find a way to pass subscription ID in checkout session.
Any help would be much appreciated
Share Improve this question asked Nov 22, 2021 at 19:24 RajanRajan 1471 silver badge12 bronze badges1 Answer
Reset to default 17You are trying to update an existing Subscription through a CheckoutSession, that is not supported.
If a customer uses Checkout to sign up for a new Price, that creates a pletely new Subscription object. You cannot pass an existing Subscription ID as Checkout cannot modify that.
You should use Checkout in mode: setup
to collect card details from your customer. This setup
mode only collects card details but does not charge or create a Subscription on that Customer.
Then in your server-side code after you receive the checkout.session.pleted
webhook event, update the existing Subscription to switch from the "free" Price to the "paid" Price: https://stripe./docs/api/subscriptions/update