#Jerry Jose
1 messages · Page 1 of 1 (latest)
Webhook event is recommended. You can refer to the details here: https://stripe.com/docs/payments/checkout/fulfill-orders
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
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
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)
One way I can think of is to use payment_intent.* events that Checkout Session is under the hook.
- When creating a Checkout Session, add the unique key-value pair (such as order reference ID) under
payment_intent_data.metadatain the request: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata - 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 paymentpayment_intent.succeeded- successful paymentpayment_intent.canceled- cancelled payment (when checkout session expires)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.