Struggle to make change to user with data from stripe

hi bubblers..
im trying to make a setup with stripe and a backend workflow to request data from stripe..
that also works fine.. it gets the request.. i see in the log that the data gets requested.. but it cant identify the user to put these data on..

this is my workflow for it:

You’re searching for User by Customer ID..

Buy you haven’t set the Customer ID on the user yet (hence why it doesn’t find the user, as there isn’t one to find).

There are a few solutions.

  1. (my preference) create the Customer in Stripe first, and store the Customer ID on the User, before creating the subscription / checkout session etc.. Then the User in your app already has a Stripe CustomerID, so it’s simple to find the user on the backend based on that.

  2. Pass the User’s unique ID into the Stripe call as metadata (or as the ClientID in a checkout session), then use that on the backend to find the User.

  3. Use the email of the User instead.

hi @adamhholmes
thank you for you response..

just to clarify, because you say the “subscription.checkout session”
i use the event customer.subscription.created because with the one your mention i wasnt able to request the product id and i neded that to further rules.

also.. im trying to make the setup with stripes product table.. dont know if that makes any different.. but how do i create the customer in stripe first?

Apologies… I meant “subscription / checkout session etc.” (as in subscription OR checkout session, or whatever API call it is you’re making to Stripe to create the Subscription). I’ve corrected that now.

The first step in your WF should be to create a customer in Stripe (using the customer API), and then assigning the returned Customer ID to the User.

But only, of course, if that User doesn’t already have a Stripe customer ID

Then, just always pass the User’s Customer ID into the stripe call as the Customer.


this is my first time working with stripe and bubble.. so im a bit unknowledge.. all the process i got to know is from tons of YT videos.. but im not sure how do i create the customer prehand in stripe? doesnt that happens already when the user click on the subscripe button.. ?

Ah… it looks like you’re using the Stripe Bubble plugin…

I can’t say to much about it as I don’t use it (nor do I recommend using it) but it looks like you can’t create a customer with that plugin. So that option wont’ be possible.

You also can’t pass custom metadata into a checkout session - so you can’t use method 2 either.

So you can either use the email address to locate the User OR you can set the Stripe_Customer_ID field on the front end after the checkout session completed.

That said, there is really no reason why you need to store the Stripe Customer ID on a separate custom field, as the Bubble Stripe plugin already stores it on the built in system Stripe Customer ID field, which you can access in just the same way as you would the custom field (so there’s really no need to duplicate it).

Although, in either case, you won’t be able to use that in the webhook to retrieve the customer as it’s likely the webhook will fire before the front Customer ID is retrieved, so will not be able to find the User.

So you’re best bet is to use the email address to locate the User

(or, better still don’t use the Bubble Stripe plugin - just use your own API calls so you have complete control and none of the limitations).

if i want to use the email, do you then know what data to search for?

Assuming your request data is a ‘subscription’ object, it won’t contain the customer email address directly (only the customer ID) - so you’ll need to retrieve the customer object in order to establish the email address.

If you’re using the Bubble Stripe plugin you can get that via the Get Customer Data Call (using the customer ID from the webhook data).

Alternatively, you could use a checkout_session.complete event instead of the subscription.created event, as that does contain the email address of the customer (and also the subscription ID - but not the subscription status).

I’d still suggest it’s simple (and better) to make your own API calls for this (rather than use the Bubble plugin) as that way you can pass the User ID directly into the Subscription object via the checkout_session.subscription_data object - then just retrieve the customer without needn’t to make additional API calls.

(or create the customer before the checkout session).

im not sure how to do that?

i have thought about using my own API call.. im just not completly familiar in how that works yet.. have maked a few API calls for something else but it took weeks to understand and set it up and its still not completly on the understanding for how it works..

this process im trying to make now is what i found on multiple YT videos there is the best way if not using my own API calls.. but yeah.. still doesnt know how to collect the user information

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