#sheffjames_webhooks

1 messages ยท Page 1 of 1 (latest)

heavy novaBOT
#

๐Ÿ‘‹ 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/1278075003723710616

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

thin dew
#

Here we can see what's happening, plus the time differences involved

pale pollen
#

Hello
Can you share the event IDs instead of the invoice ID? It is possible that the events are related to some other invoice..

The invoice ID you shared was finalized at - 2024-08-27 18:12:13
Then it required additional actions so we sent payment_intent.requires_action at - 2024-08-27 18:12:14
This also generates invoice.payment_failed which we sent at - 2024-08-27 18:12:14

after that customer completed required action and payment succeeded so we sent invoice.payment_succeeded at 2024-08-27 18:12:58

so all of that seems expected

#

(timestamp above are UTC)

#

Ah actually

#

looks like the first two delivery to your endpoint failed

thin dew
#

Hi Hanzo, the first two failures seemed to time with my banks 2FA payment confirmation process

pale pollen
#

so the webhook event delivery was retried at 2024-08-27 19:12:07 UTC

thin dew
#

But that's guesswork

pale pollen
#

If you look at webhook attempts on the link I shared above; your code responded with
Unable to update subscription, please contact us at support@helpmesaythis.com

#

it did the same thing again when we retried it for a second time

thin dew
#

Hmm but then it went through fine after that, until the problem of the hour-delayed payment failure of "evt_1PsTsII61fHTBUSGd8P37W7O"

#

Apologies if it seems I don't know what I'm talking about, I'm very new to all of this

pale pollen
#

All good. Let me clarify it..

When the bank requested 2FA at 2024-08-27 18:12:14 , we generated invoice.payment_failed and sent it to your endpoint at - 2024-08-27 18:12:14

Your webhook endpoint failed to respond with a 200 status which Stripe considers as failure of delivery.

#

So we retry it

#

until we receive 200 status response

#

which we did at 2024-08-27 19:12:07 UTC

#

So from your perspective you only saw the third attempt

#

which was an hour later

#

but in reality, it is the same event we tried to deliver an hour before

thin dew
#

Ah right. If the invoice.paid "evt_1PsTt1I61fHTBUSG7Mxv1BtQ" went through though, why was another attempt needed?

pale pollen
#

For Stripe, each event is different/distinct. Our logic doesn't really check if a separate event for the same object was received successfully or not. That's something we leave up to the developers.

#

So it is upto you to check if you've already received a paid event for this invoice

#

if so, you can ignore the retried event

thin dew
#

Gotcha. It seems I should check for whether or not there has beena. successful payment within the last few hours or so

pale pollen
#

Correct.
You should also tweak your invoice.payment_failed event handler to recognise if the event was generated for 2FA/3DS. If so, you don't want to update the subscription

#

Based on the error your code returned, I assume you're updating the subscription as soon as you receive invoice.payment_failed event

thin dew
#

Exactly

pale pollen
#

which would fail for initial invoice since the subscription isn't really active at that point

#

or in a state where it can be updated to a different status in this case

thin dew
#

Great. Thanks hanzo, you've cleared that up for me nicely

pale pollen
#

NP! ๐Ÿ™‚ Happy to help

thin dew
#

I don't know how to mark this as complete

pale pollen
#

Don't worry about it, I've got it

thin dew
#

Enjoy the rest of your day