#poneciak_payment-inventory

1 messages ¡ Page 1 of 1 (latest)

subtle hemlockBOT
#

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

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

gray sandal
#

poneciak_payment-inventory

simple tusk
#

in wich step should i lock the items for the client ?

gray sandal
#

when you are ready to confirm the PaymentIntent

simple tusk
#

so:

  • Server: creates payment intent sends it to the client
gray sandal
#

yes

simple tusk
#

uh i sent to early XD

#

and then then client accepts that intent and pays

#

and if intent failed i unlock the inventory

gray sandal
simple tusk
#

and if intent succeeded i change the order status

gray sandal
#

but yes I would reserve inventory on PI creation and release it after a few minutes, like what ticket concert selling platforms or airline websites do

simple tusk
#

ok i see there is an event payment_intent.succeeded but is there any event when payment fails

#

or do i need to specify the time for items to unlock automatically

gray sandal
#

there's payment_intent.payment_failed. But really you need to add some specific timer on your end since your customer might leave the page and never confirm

simple tusk
#

Yeah, I just thought about that a moment ago

#

ok but what if it just took the customer that long to pay

#

and my API receives success event

gray sandal
#

That's really up to you to decide!

#

You own the whole code here, you can block confirmation of the PaymentIntent after the timer

#

that's exactly what a those website examples I gave you would do

simple tusk
gray sandal
#

yes but you are the developer here, you handle the confirmation client-side. so you can block the confirmation after 10 minutes.

#

You can also cancel the PI if it's too late so that they can;'t pay it again

#

or you can reset the timer if no one else is buying and updated the countdown. Really this is something you need to model based on your own business model.

simple tusk
#

ok i got it

#

thanks for help

gray sandal
#

Sure thing!