#jack-checkout
1 messages · Page 1 of 1 (latest)
hi! well checkout.session.async_payment_succeeded won't get fired for cards.
What you probably want to do is listen for both. In the .completed event, check the type of payment method used. If it was card, then you can fulfill the order. It if was something else, then do nothing for now(or just update your database etc). In the .async_payment_succeeded event, you can fulfill the order always.
https://stripe.com/docs/payments/checkout/fulfill-orders#delayed-notification
That's simple enough, thank you.
Just wanted to check that i had to do both rather than handling it with one single event
i'm currently firing it on payment_intent.succeeded which is likely wrong as i was previously using payment intents/elements.
I'll want to remove that and listen for these instead yeah?
yes, I would use the Checkout specific events, they're more consistent
Do you have an example anywhere of checking if the payment method was card or bacs?
I assume its attached to the data sent in the event but cant find the page on the docs with it
the most reasonable way is when you handle the event, retrieve the CheckoutSession object from the API by its ID, and expand fields like payment_intent . The type of payment method used is session.payment_intent.charges.data[0].payment_method_details.type
https://stripe.com/docs/expand/
https://stripe.com/docs/api/charges/object?lang=node#charge_object-payment_method_details-type