#infj-software-engineer_webhooks

1 messages ¡ Page 1 of 1 (latest)

low pebbleBOT
#

👋 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/1412834477713002698

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

past shell
#

The order for the events you're listening to is as follows

For successful payments:

  • payment_intent.created
  • payment_intent.succeeded

For failed payments:

  • payment_intent.created
  • payment_intent.payment_failed

For failed payments and you or Stripe cancels the payment:

  • payment_intent.created
  • payment_intent.payment_failed
  • payment_intent.canceled

You or Stripe cancels the payment:

  • payment_intent.created
  • payment_intent.canceled

Our doc on Payment Intent statuses may be helpful [0].

[0] https://docs.stripe.com/payments/paymentintents/lifecycle#intent-statuses

static kayak
#

yes that order makes sense, but is there a field that will tell me that? can't payment intents shift between states?

#

for example:

  • payment_intent.created
  • payment_intent.payment_failed
  • payment_intent.succeeded
past shell
#

Yes it can if there are attempts to retry the payment and it eventually succeeds.

static kayak
#

so my question is: how can i look at the payment intent events and figure out the order of the updates?

#

without having an idea of the state machine on my backend?

past shell
#

We return status in the PaymentIntent object.

#

If the event is payment_intent.payment_failed the status of the PaymentIntent will likely be requires_payment_method.

static kayak
#

okay, thanks

#

let me give an example. i have a payment intent which was created and then the charged and then it failed.

I have 2 events:

  • payment_intent.created
  • payment_intent.payment_failed

i understand that each object has a status. but if my webhook receives these events out of order, how do i handle the table update?

#

the created time for both of the events is the exact same unix time

past shell
#

Unfortunately we do not guarantee the delivery of events in the order they are generated so we recommend that youe integration isn't dependent on receiving the events in a specific order [0].

[0] https://docs.stripe.com/webhooks#event-ordering