#tadpole

1 messages · Page 1 of 1 (latest)

marble kilnBOT
outer spire
#

You can then also listen for payment_intent.succeeded to catch the async payments that complete later.

idle sable
#

Wouldnt that lead to duplication? As in a single event will be handled by checkout.session.completed where payment_status is true and payment_intent.succeeded.

#

Also Im a bit confused as to why payment_intent.succeeded is emitted for async payments given there already exists checkout.session.async_payment_succeeded

outer spire
#

Yeah, you would only care about the payment_intent.succeeded Events where the Checkout Session wasn't paid.

#

There are historical reasons the Events ended up this way. I agree it's a bit confusing.

#

The best thing to do is test a lot in test mode to get a feel for which Events fire when, and for what methods of payment.

#

That will let you build a system that works exactly the way you want.

idle sable
outer spire
#

Yeah. I mean, ultimately it's up to you and what works best for what you're building, that's just one approach.

idle sable
outer spire
#

You can also just listen for payment_intent.succeeded if you don't really care about the Checkout Session Events, but a lot of people want the Checkout Session data.

idle sable
#

yeah my usecase is quite simple, 1 time payment, and i want to propagate some info about the purchased item and user such that when payment is made, don't care how it is, I can get that info so I can create a record in my db

#

So it seems, I can just do payment_intent succeeded and it will handle that, whether they paid with async or not, right? If I wanted to also handle failures the same way irrespective of how or for what payment, could I also listen to payment_intent.payment_failed?

outer spire
#

Yep.

idle sable
#

And I am assuming I can pass in the info I need to create my db entry with in paymentintent metadata to access it in those web hooks

outer spire
#

Yep, that approach should work.

idle sable
#

okay thanks a lot for your time and help!

outer spire
#

No problem!