#dorian6730_docs
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/1369088844908990504
đ 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.
- dorian6730_docs, 6 days ago, 6 messages
Hello
For that specific flow, backend code in Step 4 and 5 runs after customer clicks submit.
The idea is to create a customer using the API (if one doesn't already exist. If one already exists, retrieve it using the API). Step 5 is to create a SetupIntent for that specific customer ID and respond with client-secret.
So when the customer "submits", your client-side code gets a SetupIntent from your server for a specific customer & confirms it using the collected payment method information.
How do I trigger Stripe to validate what the user has entered
If you're referring to the card information, we automatically validate the format of the card number, expiry etc when they're being provided in the elements.
Thanks @mellow wren. Yes I see those validations now, thanks. Is there a way for me to know when all entries are valid, so I only enable my Submit button then?
Yes.. You can listen for change event on PaymentElement & look at complete param to identify if the necessary details have been provided with potentially valid inputs - https://docs.stripe.com/js/element/events/on_change?type=paymentElement#element_on_change-handler-complete
Got it thanks. So once I get that change event, I enable my Submit button, the user clicks it, I create a custoemr if one diesnt exsits, create the setup intent, return that to the frontend wheere the final step is #6, Submit setup to stripe.
Yup. You can inspect the code in Step 6 under handleSubmit
Got it thanks