#andy_best-practices
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/1332355693180616876
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Is there a way to automatically create a new Stripe Customer when the Stripe Elements form is submitted?
No. But you can make a Stripe API call from your backend at that point and create the Customer
In your frontend submit function, you make an API call to your backend which well create the Stripe Customer.
Shouldn't this happen after the SetupIntent has succeeded (therefore, asynchronously)?
Since it's a No, does my plan below fall under the Best Practices category?
T+0 - user submits the form
T+1 - user is redirected to some "Please wait" page that keeps polling for the new payment method
T+2 - stripe sends the setup intent event to the webhook endpoint
T+3 - read the event, create a new Stripe customer, associate the payment with the customer
T+4 - user sees the new Payment Method added to their account
Actually you can preview the Element and submit the payment before creating an intent
Take a look at this:
https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup
Hm. From the link you shared, it's not clear when the server is invloved.
Well, Step 4 says:
Create a Customer object when your customer creates an account with your business
But that's what I'm trying to avoid - polluting the Stripe Customers database. Who is calling the Step 5? I could potentially create a new customer during this step.