#timmmy - customer mapping

1 messages ยท Page 1 of 1 (latest)

fathom badger
#

What problems does this cause? It's really up to you. You could create the customer before you create the checkout session and associate them right away, and delete any that don't complete checkout

autumn pendant
#

Okay so I have been told that its best practice to assign the Stripe Customer id to my db user once that event gets triggered

#

The problem is that the event only knows the Stripe Customer Id and not which db user the customer belongs to

#

So how do people usually go about this?

I was thinking about manually creating the Stripe Customer once a user tries to initiate a checkout session (And assign the user the Stripe Customer id)

#

I just dont how that is supposed to work

#

How should I save the Customer ID in my db if I dont know to which user it belongs

fathom badger
#

When you create the session you can set your own customer db id in the metadata, for example

#

Then when you receive the webhook you can map these together

autumn pendant
#

That sounds exactly like what I was looking for

#

let me take a look at that

fathom badger
#

๐Ÿ‘

autumn pendant
#

Okay so I set my user id as meterdata in checkout creation right?

#

and then read that info in the Checkout.Session.Completed event