#noroup_webhooks
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/1386781943458300006
đ 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.
- noroup_webhooks, 5 minutes ago, 4 messages
"Hi there. For starters, I'd recommend reading this guide on the PaymentIntent's lifecycle:
https://docs.stripe.com/payments/paymentintents/lifecycle
but my question is - why not wait until PaymentIntent success before deducting stock from the database?"
Doesn't paymentIntent success mean the customer successfully paid for the product? The payment may go through without ensuring that there is stock available for the user
Hello
Give me a moment to take a look at your previous thread
Of course, thank you. it was closed before I could respond
I was under the impression that if the Payment Succeeded, the user has successfully paid.
In my script, I am running a function to check if the stock exists, deducting the stock, then creating a payment event
You could do
Check stocks -> if exists, mark one as pending -> create the payment -> payment succeeds -> deduct the stock & if payment fails -> mark the item as available
That is pretty much what I am doing
My only concern is that the payment never fails OR succeeds, and the stock is stuck in pending
but I can run a job every 15 mintues which closes out the payment intents and restocks if it passes a set duration of time
You could set a timer on your end. If payment doesn't succeed or fail under let's say an hour, item goes back to inventory and you call the Stripe API to cancel the PaymentIntent
yup
Got it, thank you. Just want to confirm if the payment intent is successful, does that mean that the user has successfully paid?
Is that when we should credit the user with what they purchased?
Yup
Got it, thank you very much this confirms everything I was thinking