I am using the Stripe Card Element for my website. The page that allows users to purchase a product is public-facing (you don’t need to login) hence there is a lot of casual browsing.
I followed Stripe’s card element docs for my website. One of the things that they recommend is to immediately load the paymentintent object on the page if you know how much the user will be paying. I’d like to know if I can create the paymentintent after purchasing instead of creating it on page load?
It’s becoming hard for me to navigate through the stripe dashboard because of all the incompleted paymentintents that are popping up.
2
Answers
Yes. But during the payment rather than afterwards. Steps:
There’s more to do if you are using 3DS2, but that’s the gist
There is a new feature introduced by Stripe recently, which allows you to collect Payment details before creating an Intent[1].
In your case, you can load the Stripe Payment Element, collect the customer’s payment details then create the PaymentIntent, confirm it and handle any post required actions (aka 3DS).
You can even add custom logic on server-side according to what PaymentMethod was used by the customer[2].
[1] https://stripe.com/docs/payments/accept-a-payment-deferred
[2] https://stripe.com/docs/payments/finalize-payments-on-the-server?platform=web&type=payment#insert-custom-logic