#shuffo_unexpected

1 messages ¡ Page 1 of 1 (latest)

ocean fulcrumBOT
#

👋 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.

untold shale
#

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.

green magnet
untold shale
#

Yep, we're using this.

How do we detect a Paypal payment failed on a checkout session?

green magnet
#

Can you share an example of a Checkout Session

#

to better understand your use case

untold shale
#

Sure, would you like the JSON body of one or something else?

green magnet
#

Just the Id

untold shale
#

cs_test_a1qOl1b48YGUQ3T47AaTT5Pd7pVkWilHCZg0lZeNipjv4Pq49esp2Q2c8c

#

that was a successful checkout ^

an unsuccessful one:

cs_test_a1DVC401dlSP8ep50kub90gGWAc34jIRE6qB5ekKJWFvn7fj5zXAMX3V2k

green magnet
#

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

untold shale
#

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.

green magnet
untold shale
#

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?

green magnet
#

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.

untold shale
#

Ok thank you

green magnet
#

Welcome!