#naama-magami_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. Thank you for your patience!
โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.
๐ 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/1214258497856737280
๐ Have more to share? You can add more detail below, including code, screenshots, videos, etc.
Hi ๐
I'm not sure I understand what you are asking here. checkout.session.expired fires when the checkout session expires. https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-expires_at
If there is a payment intent associated with this Checkout Session that will be canceled.
ill exaplain better - im creating a new checkout session, and in return i get the session url.
is the payment intent created event sent at the same time that the session is created?
That depends on your API version
how come?
In earlier API versions, the Payment Inten was created at the same time the session was created. Starting with version 2022-08-01, we only create the Payment Intent when the customer confirms the payment
how can i know the api version im using? i see i use stripe-go/v72
Are you logged in to your stripe account in a browser?
yes
When you go to the API reference doc, you should see your Account name and the default API version in the lower left corner of your brownser
https://docs.stripe.com/api
Correct
i still don't understand exactly when does it mean "when the customer confirms the payment". If the customer sees the checkout page, he enters he's payment method details and then clicks pay - when does the payment confirmation happenes?
When the customer clicks the Pay button (after filling out their payment method details).
oh cool, ok thanks!
and regarding the canceled event, when is the payment intent being canceled?
When the session expires.
If there is a Payment Intent associated with it
So that would only happen on older API versions
so because older api versions create the payment intent when the session is created - the payment_intent.canceled event will be sent when the session is expired?
and in newer versions, do we have this event?
Correct
In the newer API version, the Payment Intent doesn't get created so the event doesn't fire
also, is the payment intent created if the user clicks pay but the paymet failed?
and when will i see the payment_intent.canceled event?
What do you mean? I just told you. In the old API version, you will see it when the session expires. In the newer version you won't. The only time you would see the canceled event fire is if you created a standalone Payment Intent and then manually canceled it.
i mean in this case we just talked about in the new versions - when user tries to pay but payment fails, cause we said that the payment intent is created this way
but what if the session expires here? cause we do have a payment intent now
Sorry I find this line of discussion very confusing. What scenario are you referring to in this case?
You can, and should, test your entire flow end to end for all scenarioes in Test mode. That will generate all of these events and allow you to clearly identify exactly when they will occur
in the new api version, the customer tried to pay and failed. in this case we said that the payment intent is being created.
so we have the events:
payment_intent.created
payment_intent.failed
right?
so, if we have the payment intent connected to the session, won't we also get the payment_intent.canceled when session expires?
No, the session does not expire. It was successfully completed and checkout.session.completed will fire.
The completion of the session just means the customer succesfully completed the form and attempted to confirm the payment
Whether that payment fails or succeeds
I recommend you test this with one of our test cards that trigger payment failures: https://docs.stripe.com/testing#declined-payments
It's much easier to get your head around once you see it in action
ill try to, thanks!
There's even a whole set of different webhook events if you are using an async payment method. For example, if you plan on accepting payments using Direct Debit, the payment might not fail for up to 3 days. You can use these test details to try that out too.
https://docs.stripe.com/testing#non-card-payments
Those are the cases where we fire events checkout.session.async_payment_failed https://docs.stripe.com/api/events/types#event_types-checkout.session.async_payment_failed
Or, if the payment goes through, checkout.session.async_paymnet_succeeded