#Jerry Jose

1 messages · Page 1 of 1 (latest)

olive tigerBOT
torn fiber
errant tartan
#

checkout fulfill is only about the session completed, what about the payment processing and failure

#

for example when user click pay, the payment is getting started (processing) incase if there is any issue in payment then the transaction will be failure state.

#

So how we can get these details

torn fiber
#

When Checkout Session is used, customer can retry making payment until Checkout Session expires

#

If payment is successful, checkout.session.completed event will be sent

#

If payment fails and does not complete the payment after expiry, checkout.session.expired event will be sent

errant tartan
#

Ok thanks
But here I want track all status of each transaction to maintain in my DB.
example when user start the payment process then I should create new record with status started in DB, like after click pay button in checkout page then add new record in my DB with status in progress. If the payment is success the update the record with status Success

#

So I need to get the payment status like(progress, success or failure or cancelled)

torn fiber
#

One way I can think of is to use payment_intent.* events that Checkout Session is under the hook.

  1. When creating a Checkout Session, add the unique key-value pair (such as order reference ID) under payment_intent_data.metadata in the request: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata
  2. You can then listen to payment_intent.* events with corresponding metadata in payment intent object: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-metadata
  • payment_intent.payment_failed - failed payment
  • payment_intent.succeeded - successful payment
  • payment_intent.canceled - cancelled payment (when checkout session expires)