I have users who automatically put on the Free plan upon signup.
When they want to subscribe to the Pro plan, I’d like to update an existing Free subscription rather than creating a new Pro subscription and cancel the Free one.
I couldn’t find any relevant parameters I could pass to const session = await stripe.checkout.sessions.create(...)
to achieve this.
Is there a way? Or, will sessions.create
ALWAYS create a brand new subscription?
Hello!
If you want to build a flow to renew an existing subscription, you can use the Customer Portal instead of the Checkout Session.
Use stripe.billingPortal.sessions.create
and specify subscription_update
as flow_data[type]
. Then add the necessary information to the flow_data[subscription_update]
parameter.
See the following documentation for more details:
@hidetaka-stripe Thanks for your reply.
I see that I can pass the subscription id to update in subscription_update
, but I can’t see where can I pass the price id of the Pro product the user clicked to upgrade to. I don’t want the user to have to select Pro again in the customer portal since they already indicated they want Pro. I want them to go straight to filling the payment method. Is this possible to achieve?
In your case, you can use flow_data[type]= "subscription_update_confirm"
for redirecting the user to the update confirmation form associated with the specified plan.
You can specify the new price id and quantity in the flow_data[subscription_update_confirm]
attributes: Create a portal session | Stripe API Reference
@hidetaka-stripe That’s closer to what I was hoping to achieve. However, there are a few issues with this approach:
- There is no Back/Cancel button on the Confirm page. Is there a way to add it?
- When the user lands on this page (using the subscription_update_confirm flow), they see a Confirm button but no payment method inputs. Only when they click Confirm, they see an error message saying “You have no payment method on file. Please add a payment method to use for Phonic Starter.” and then they can enter the credit card details. This doesn’t feel right. It feels like Stripe show know that the customer doesn’t have a payment method and should display the payment method fields on the first Confirm screen. Any ideas why that’s not the case?
- To use subscription_update_confirm, I had to enable “Customer can switch plans” in Billing → Customer portal settings. I actually don’t want users to see the “Update plan” button when they visit the customer portal. I want my users to always initiate the plan switch in my app. Any ideas how to deal with this?
@misha_phonic We had a similar hurdle here. You would think that if a customer had no payment method on file then it would ask for that when the customer clicks confirm, OR potentially I wonder if you can palm the customer off to payment_method_update
first and then after they click Add, they could be redirected to subscription_update_confirm
?
How do I add the ability to change all available prices from products in subscriptions? Because I can only add 1 price per product
I think the ability to be able to support a subscription.id
in the checkout session would be a valuable addition allowing the output be an UPDATE to a subscription rather than a CREATE NEW subscription, as we would need to cancel the existing one.
the Customer Portal is obviously the current workaround to this problem however, what if im in a trial and haven’t provided a payment method or want to switch plans?
- I don’t want to subscribe to
PRODUCT A
im currently trialling, I want to subscribe toPRODUCT B
. - I don’t want this plan to be visible in the Customer Portal as one they can change to after the fact.
- I want to add one time purchases in the same payment OR I want to add additional recurring products to the same subscription (mixed cart)
Thank you for this great idea!
It would be very useful to check if a payment method is registered for a customer and then change the type of Customer Portal deep link to launch.
As commented here, we recommend using payment_method_update to send users who do not have payment information on file to a different customer portal deep link.
If you don’t want to change the customer portal settings, you can set up a custom configuration that is only used through the API.
Use the Create a portal configuration API to create a configuration that is only used for this approach.
Then, when creating a customer portal session, set this configuration id as a parameter.
I apologize to the author for writing in this thread.
I tried to create a configuration but got the following error: “For each product, its price must have unique billing intervals. The following prices have duplicate intervals: …” It is quite logical that a product can have several prices (depending on the product configuration - for example, renting an Audi Q7: Basic or S Line) with the same billing interval. We have a product “Audi Q7” and two price options with a monthly rental payment - “Basic” and “S Line”. But we cannot create a portal configuration for this product.
P.S. Theoretically, we can create two configurations. But if we have ten products …