#cryptiano
1 messages · Page 1 of 1 (latest)
in other words, do i fulfill the order on checkout.session.completed or charge.succeeded event?
Hi, yes that is possible. That event, https://stripe.com/docs/api/events/types#event_types-checkout.session.completed just means that the Checksout session itself successfully completed. If you're trying to get notified after a charge succeeded, you shoudl listen to charge.succeeded.
I see
alright thanks
@cosmic viper but Charge object doesn't contain client_reference_id
only the Sesison object does.
Let's back up, what are you trying to do here?
I want to listen to an event from Stripe that tells me that payment is successful
i used Checkout Sessions and gave it my internal sale id as the reference.
rn im listening to checkout.session.completed event and using Session:client_reference_id to find my internal sale.
I see, in this case, I would pass in metadat on the Payment Intent:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata and you could listen to https://stripe.com/docs/api/events/types#event_types-payment_intent.succeeded event to listen to successful payments. Then, on the Payment Intent object, you'd have that metadata to later reference as.
thx. can you give me a scenario where checkout.session.completed is fired, but payment is failed?
It would happen for asynchronous payments like ACH Direct Debit payments where it takes a few days to receive success or failure: https://stripe.com/docs/payments/ach-debit acknowledgements.
I see
Alternatilvely, you could use listen to charge.succeeded event, and after the Checkout Completion, you could pass in the reference id as the metadata on teh Charge object: https://stripe.com/docs/api/charges/update#update_charge-metadata. It's really up to you here.