#nato_best-practices

1 messages ¡ Page 1 of 1 (latest)

pine merlinBOT
#

👋 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/1405985610950246534

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

gilded hare
#

then running the backend check before confirming the setup intent
You mean before creating a payment intent?

#

You can confirm a setupintent without an availability check

#

All a setupintent does is set up a payment method for future use

humble cairn
#

Thanks for getting back so quick!

Right now I create a payment intent on the backend when users open the checkout screen, and then pass it to a payment sheet for the user to confirm it. Unless I'm missing something, after the payment intent is created, the flow for confirmation is entirely on the frontend, so I can't see a good place to fit a request to my backend to check for product availability that wouldn't create a window for multiple people to run payments on the same item.

To run the payment immediately after making sure its available for purchase, I figured the best way would be to create a setup intent, pass it to the frontend, have the user attach a payment method and authorize its use, and then catch the setup success webhook on the backend where I run the availability check and then immediately process the payment with the setup intent.

gilded hare
humble cairn
#

Okay just finished reading the article, and it looks like what I was looking for!