#coding-lover_checkout-fullfilment-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/1395477624171794474
π Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi π
I'm not sure I understand the specifics of your quesiton. Could you give a step by step description of the scenario you are considering?
my 2nd Question is does checkout.session.complete only run for successful payment if that the case thy this check
The checkout.session.completed event fires whenever a Customer completes a Checkout Session. This will be for successful payments if the Payment Method has synchronous confirmation. Some payment methods, like ACH Debit, are async and can fail after the Checkout Session completes.
so if payment method has sync confirmation why there is if condition
I don't know where the code snippet you shared comes from
That code snippet covers the use-case where checkout sessions are completed but not paid
It's up to you to decide if that is a scenario your integration will run into
In case of async payment method there is another event checkout.session.async_payment_succeeded'
but currently I am focusing sync
Okay, so you can ignore that (or leave it in with some logging in case the code gets there).
ok
so how it is possible stripe request webhook endpoint two time concurrently same time
Sorry, but I don't know what those words mean.
this is from stripe docs
Prevent extra fulfilments
Perform fulfilment only once per payment. Because of how this integration and the internet work, your fulfill_checkout function might be called multiple times, possibly concurrently, for the same Checkout Session. Performing checkout only once ensures this wonβt cause undesired behaviour.
Okay so concurrent requests hitting your webhook endpoint, got it!
There are circumstances pertaining to how the Customer is interacting with the Checkout Session and their browser that could trigger double event payloads. Stripe makes no guarantee that we won't send a duplicate event and, because we have multiple concurrent processes running on our server, it is possible these may hit your webhook endpoint at the same time.
You should code checks into your system to prevent duplicate processing. You can use the Checkout Session ID to track what sessions you have responded to.
Sure thing, happy to help π