#coding-lover_checkout-fullfilment-webhooks

1 messages Β· Page 1 of 1 (latest)

median magnetBOT
#

πŸ‘‹ 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.

jagged sparrow
#

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.

candid berry
#

so if payment method has sync confirmation why there is if condition

jagged sparrow
#

I don't know where the code snippet you shared comes from

candid berry
jagged sparrow
#

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

candid berry
#

In case of async payment method there is another event checkout.session.async_payment_succeeded'

candid berry
#

but currently I am focusing sync

jagged sparrow
#

Okay, so you can ignore that (or leave it in with some logging in case the code gets there).

candid berry
#

ok

#

so how it is possible stripe request webhook endpoint two time concurrently same time

jagged sparrow
#

Sorry, but I don't know what those words mean.

candid berry
#

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.

jagged sparrow
#

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.

candid berry
#

ok

#

thanks for help

jagged sparrow
#

Sure thing, happy to help πŸ™‚

median magnetBOT