#raenk

1 messages · Page 1 of 1 (latest)

bitter shaleBOT
summer raft
#

Hi 👋 sort of depends on your integration. You can run through a test payment in the test flow that you've built, and see what testmode Events that generates and when.

Typically payment_intent.succeeded or charge.succeeded are good options, but there may be better depending on your flow or the information you'd like to receive.

edgy wadi
#

Thanks. Basically I just need to be 100% sure that payment went through. And while on this, I need to handle also async payments, but I need to handle these completely independent from each other.

#

I was thinking on charge.succeeded and checkout.session.async_payment_succeeded

summer raft
#

There are separate Events to listen to for async payments, yup like that one. Are you using Checkout Sessions?

edgy wadi
#

Yeah, but I made the mistake to listen for checkout.session.completed for cards and checkout.session.async_payment_succeeded for payments fulfilled at convenience stores with a QR code

#

I just discovered that both methods would generate checkout.session.completed events

#

So i want to make sure I don't listen to events that overlaps

summer raft
#

Yup, you would need additional logic to check the state of the Payment Intent associated with the Checkout Session.

edgy wadi
#

What would you consider the simplest way to check for both methods? Or, if one event can be enough for both

summer raft
#

Hm, I'm not sure we have wholly discrete Events for those scenarios.

#

Do you have recent example payments handy that you can look at Events for? I don't recall exactly, but am thinking payment_intent.succeeded may be what you're looking for. The delayed payments should land in payment_intent.processing until they're finished, and then resolve as succeeded or failed.

edgy wadi
#

Yes I do, but since my webhook isn't set to listen to payment_intent.succeeded, I don't get to see those events in the logs

#

I could use one event for both cases since I'm not taking different actions for each. Basically I'm getting only the payment intent ID and metadata that I send which I guess is retrievable in any case, right?

summer raft
#

Yes, if you listen for payment_intent.XXXXX Events, they will contain a Payment Intent object.

#

The Events are still logged in Stripe (as long as the transaction is recent enough) even if you didn't log them on your end.

edgy wadi
#

Thanks. So, to sum up, It would be safe to handle payment_intent.succeeded event in any case as a successful payment without regard to the payment method considering that the data that we use from the object is only the metadata provided in first place, right?

summer raft
#

Yes, that is my belief, but please test it in test mode first to ensure I didn't forget about or overlook something specific to your flow.

edgy wadi
#

I will, many thanks!