Stripe Webhook integration - "current user "problem

Hei guys need help.

I ve followed all the creation of the new stripe account and creationg of the webhook with bubble. Everything is working generally speaking as all the information from stripe payment are written in my db in bubble.
Except something that is fundamental to me: I am not able to connect a specific payment event with the current user that paied (logged in in my bubble app).

That’s because when I create/modify things in the backend workflow the actual “current user” is empty cause it is not linked to the actual person that has the account in my bubble app.
Any suggestions?

There are many ways of doing this.
Some example:

I m sorry, I m trying to understand but it doesn’t seem obvious to me.

Should I add a metadate or so? In case how?

You can use any of the following to match the chekout session to a user, depending on how you’ve set things up in your app:

email address
Stripe customer ID
Some other Metadata you’re including in the call

from stripe docs

client_reference_id string
A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems.

This, like any metadata you add, will be saved in the checkout session object, so you can retrieve it in your backend workflow and search for the right user.

A common example is to set it to bubble’s user id

I am still not understanding unfrotunatelly!
The thing I m looking here is having the stripe customer id in my bubble app database.

Thank you @dorilama , I understand the meaning but I am not understanding how to do it exactly. DOo you guys have any video? I m looking for it since some time but can’t find it

Or can you do a sort of video I don’t know

I don’t know about any videos…

But all you need to do is Search for User, based on whatever data it is you have to connect the checkout session to the user.

Obviously in you case, you can’t use Stripe ID, as you don’t have it…

The best way is to use either the User’s unique ID, or some other unique ID of something related to the Order (i.e. Order, Cart etc).

As long as you pas that into the stripe checkout session in the API call you can retrieve it in the webhook.

Ok and how can I pass a specific information (instance: unique id of customer) to stripe?

You can use client_reference_id
or you can use some custom metadata

If you scroll the documentation you have the section on how to create the checkout session with all parameters. That plus the API connector is what you need.

I tested more times a payment and the client reference id is always null. Is it normal ?

You need to pass it when calling the stripe API when you create che checkout session.

Okei so it’s not possible by the webhook from a stripe “payment link” but I need to do the setup with the Stripe API, did i get it right?

this is done when you create the checkout session

By “creating a checkout session” you mean codings something that will contain customer reference and all the other variables…?

This request made using the API connector.