Checkout session stripe creating a new customer instead of updating a customer

Hi bubblers

so.. im trying to make a setup now where my users can subscripte to a sub subscription of pay pr seat.. and when they make a checkout session for the first time it creates a new customer in stripe instead of updating the current one..can anyone help out why that is happening?

Long standing issue, try to use custom api calls instead.

this is a custom api call.. and i have been looking in the doc for a field that i need in the call to define whenever to create or update a customer.. but cant seem to find the right one for that

Usually if you pass customer as empty with a custom API call, Stripe will create the customer, and if the customer ID is passed as a parameter, then Stripe will not create a new customer and will use the customer whose ID matches what is sent. So, likely based on your screen shot, when you are testing you are either not logged in, or the user account you are logged into does not have a stripe customer id.

When testing things like this, add a text field to the page and add the dynamic expression of Current Users Stripe_Customer_ID so you can see what the value is.

Additionally, it may be privacy rules are not configured properly if the logged in user does have Stripe_Customer_ID. OR it could be that since you were previously using Bubble stripe plugin and now switched to custom api integration, and likely have not removed the Bubble stripe plugin, it is easy to confuse the data fields as the names may be similar or exactly the same.

Did you create the data field on the User data type that is called ‘Stripe_Customer_ID’ or is that coming from the Bubble Stripe Plugin?

hi @boston85719

i have deletede both the stripe plugins because when i started to do this new setup i actully did get easily confused by them.

i have 2 calls for checkout sessions. one for first time users subscription to the main subscription.. where it should create a new customer in stripe, and save the stripe_customer_id to to bubble.. that works fine and i get the customer id saved to bubble as i should.

now in the second call is where i have the stuggles.. because this is here where i want it to update the customer in stripe and add the subscription to the customers list of subscription..
i use the parameter customer_email in the call to identify the customer in the checkout and the value of that is current users email


and when i try use both parametre im not allowed to do that

You’re creating the customer beforehand correctly, yet when creating the checkout session, it still ends up throwing these errors. Below is how the checkout session is set up in my API Connector—see if there’s anything different from yours that could be causing the issue:

Also, keep in mind that I’m passing the Authorization in the private key in the header.
I hope this helps.

thank you that helped alot :smiley:

If all you have is customer ID the call will not create a new customer. If all you have is customer email the call will not recognize an existing customer.

You need both ID and Email as Optional parameters that you set with a dynamic expression based on if current’s user stripe id is empty or not, so that you have ONLY One checkout session api call that does BOTH create new and recognize existing customers.

aaaah.. that make sense..
i think i have made a setup now based on 1 API workflow of checkout session but with conditions for each action of what plan it is.. it looks like that do the thing..

now im just struggling with the subscription.update thing instead.. :sweat_smile:
cant figure out how to add coupons to a subscription without replacing them.. hopefully i will figure that out also

This topic was automatically closed after 70 days. New replies are no longer allowed.