#mukul-bhardwaj_webhook-best-practices

1 messages · Page 1 of 1 (latest)

rigid impBOT
#

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

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

crimson nacelle
#

Hi 👋

Stripe does not guarantee any specific ordering or timing of webhook event deliveries

#

We document this here

#

Can you clarify why you are responding to both events? checkout.session.completed just means the customer has successfully completed the session but it does not indicate receipt of funds. The payment_intent.succeeded event represents a successful payment to your account.

wraith aspen
#

We want to notify the user that payment details you are provided during session has been received and your transaction is awaiting confirmation after that we will update the actually status throught payment intent event that is we want to do

#

Can you please tell if we are listening to only payment intent event how much time stripe takes to respond ?

#

Actually we are blocking the inventory and we need to release the inventory accordingly asap

crimson nacelle
#

That question does not make sense to me. Respond to what?

wraith aspen
#

How much time stripe took to call my api end point with the event object payment.intent.succeded that is what i am asking

crimson nacelle
#

We do not have any public guaranteed timing. But on average this occurs within a few seconds of the payment succeeding

wraith aspen
#

Is this reliable ?? Any worst case scenario when it took hours or day?

crimson nacelle
#

Webhooks are the best option for handling fulfillment concerns and what we recommend. The only cases where notification took hours/days have been due to failures on the user's server. If your server endpoint fails to receive the events or your website hosting network is down that would prevent receiving webhook events

wraith aspen
#

So that means stripe is reliable to deliver the response at their end.

crimson nacelle
#

Yes but, in order to build a robust integration, we would recommend having some fallback mechanism.

wraith aspen
#

If we are listening for both payment_intent.succeeded and checkout.session.completed events, and they happen to arrive at our endpoint in quick succession, there’s a possibility that both might attempt to update the same record within a transaction. We were wondering if this is something that’s unavoidable and needs to be handled on our end, or if you might have any suggestions or best practices to help manage such scenarios?

crimson nacelle
#

This is something we call out that your endpoint will need to be able to handle.

#

You should include some kind of check to validate that the transaction has not already been created.

wraith aspen
#

Yes thank you very much for the suggestion.

crimson nacelle
#

Happy to shed what 💡 I can 🙂