#shuffo_unexpected
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/1369978165019283509
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
The issue here is not knowing when Paypal payments have failed.
If payment status is unpaid then we were assuming the Paypal payment has failed and redirect them back to checkout. Due to the fact there's a delay for a successful payment to transition to paid, our code is currently redirecting back to the checkout with Paypal payment failed error (wrongly).
I'll add to this by saying that we do use Webhooks later on in the process fullfil the actual order. The webhook we listen to is checkout session completed. While this is taking place we have them wait on an order processing page.
You should listen to the webhook endpoint:
https://docs.stripe.com/api/events/types#event_types-checkout.session.completed
In order to be safe
Yep, we're using this.
How do we detect a Paypal payment failed on a checkout session?
Sure, would you like the JSON body of one or something else?
Just the Id
cs_test_a1qOl1b48YGUQ3T47AaTT5Pd7pVkWilHCZg0lZeNipjv4Pq49esp2Q2c8c
that was a successful checkout ^
an unsuccessful one:
cs_test_a1DVC401dlSP8ep50kub90gGWAc34jIRE6qB5ekKJWFvn7fj5zXAMX3V2k
Thanks for sharing, checking..
So you should listen to the event payment_intent.payment_failed
IN order to detect a Paypal failure
For the failure Checkout, you had this event evt_3RMBKXCPXVjkRWwq1Luk8QkH for example
Ok but there's no information about which checkout_session that payment intent is tied to in those events.
On checkout session creation we store the checkout session ID. We can't store the payment_intent ID because there isn't one at the beginning. As far as I'm aware a payment_intent isn't attached to our checkout_session until it's complete.
e.g I can query the checkout session anywhere along the process and the payment_intent will be null. Until it completes... then it will be there.
Ok but there's no information about which checkout_session that payment intent is tied to in those events.
You can fetch the related Checkout Session via this API call:
https://docs.stripe.com/api/checkout/sessions/list#list_checkout_sessions-payment_intent
Aka get Checkout Session by PaymentIntent Id
Ok I will give that a go, thank you. Will I be able to come back to this thread if I find further problems within a couple of hours or will I need to start a new one?
Usually threads are closed after inactivity. Feel free to reach out via the main channel, your new thread will have reference to this and all your old threads.
Ok thank you
Welcome!