#_kevinx

1 messages · Page 1 of 1 (latest)

long tapirBOT
muted moat
#

Hello Karbi

elfin tendon
#

Hello!

#

Can you give me some more details here? I'm not exactly sure what you mean thwne you say the customer ID keeps changing?

muted moat
#

Yes, so in order to set up this billing portal I just linked, it requires a customer id,

const session = await stripe.billingPortal.sessions.create({
  customer: '{{CUSTOMER_ID}}',
  return_url: 'https://example.com/account',
});

which is from the payment webhooks, such as charge succeed or payment intent succeed, for the same customer logged into our account, I noticed that if they make few different purchases, this customer id is unique each time, so the question is how to keep this cusomter id consistent for a unique customer so that they can come back and get all of their receipts, invoices, billing changes etc

elfin tendon
#

Gotcha

#

and how are your customers making purchases? Are you using Checkout? Are you creating the Customers yourself?

#

If you give me two examples of customer IDs I can also take a look at that

muted moat
#

we are using Checkout

#

sure

#

cus_OWdu4dJ6mmWEjD
cus_OYOnLumdOaLupN

#

cus_OZtxcCLi6ajI8h

#

cus_OZuBdfhD50BeG6

elfin tendon
#

So right off the bat I want to clarify - Checkout typically doesn't do any customer deduplication by default for one-time payments. Since you've created your Checkout Sessions with customer_creation: always and mode: payment we're always going to create a new Customer for each Checkout Session.

#

If you want to use the same Customer across multiple sessions, you need to be passing in customer when you create the Checkout Session

long tapirBOT
muted moat
#

Oh, got you, so in order to make the customer id consistent for retail, we need to pass in the customer id when creating checkout sessions? this is not a subscription based model

#

that makes sense, but let me check out how to implement this

radiant lotus
#

👋 stepping in as karbi needs to step away

muted moat
#

Hello, Bismarck

radiant lotus
muted moat
#

Got you, thank you!

#

so we need to capture this customer id the first time they use the checkout session¿ ?

radiant lotus
#

Yep that works or you can create the Customer object yourself via https://stripe.com/docs/api/customers/create when a new customer visits your site and then pass that Customer ID to Checkout just like you would for a returning customer where you would grab their stored Customer ID

muted moat
#

ah, that is even better, thank you!

#

Have a good one there!