#b33fb0n3_api
1 messages · Page 1 of 1 (latest)
đź‘‹ Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đź”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1438490452440645634
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- b33fb0n3_best-practices, 1 day ago, 13 messages
How can I only create a new customer when there is none with that email and not create another one, when he already exits?
We don't deduplicate customers based on an email address. The expectation would be that you persist thecus_xxxID internally that maps with a customer, then you set that on session creation for their payments
Oh I don’t have an extra backend for customers. What else can I do?
Nothing. Checkout's default behaviour is to always create a new Customer object when required (which an invoice requires), unless you pass the customer parameter regardless of whether one exists with the same email address
Hmm ok. Can I update that after the payment? For example via an webhook when the checkout.session.complete fires?
Update what specifically?
The paymentintent. Like that the payment intent will be part of only one (everytime the same) customer, when a customer with that email already exists and the newly created customer will be deleted if he is the second one with that email
No, that property is immutable after the payment has succeeded. It'll be far easier to track this internally and set it on creation
Yea, it’s for an online shop and by default the user is not signed in nor does he give me the email before checkout… so I don’t know any user details before he submitted the checkout session :/
Right, but you said these are existing customers?
So the implication is that they've made a payment on your site before that has likely created a Customer object (cus_xxx). You need to persist that ID somewhere in a session and re-use it when that customer returns to your site
No other way to prevent the creation of multiple Customer objects with the same email