4. Verify Payment
You must always verify payment status from your backend
Before delivering the goods or services, please ensure you call check the
order
status from your backend. Once a payment is initiated, you can verify the payment by following methods-
Use Payment Callbacks to trigger the payment verification
Refer Payment Callback
Once the payment callback is received from the SDK. You can verify the payment in various ways.
1. Call GET Order or GET Payment APIs to know the status of the order/payment
Refer following API docs -
GET Order
GET Payment for an Order
GET Payment by ID
Note
Call GET status APIs from backend as this API uses your secret key.
Example of GET Order API call
curl -XGET -H 'accept: application/json'
-H 'x-client-id: "YOUR APP ID GOES HERE"'
-H 'x-client-secret: "YOUR SECRET KEY GOES HERE'
-H 'x-api-version: "2023-08-01"'
'https://sandbox.cashfree.com/pg/orders/{order_id}'
{
"cf_order_id": "594193729",
"entity": "order",
"order_amount": 1.00
...
"order_status": "PAID",
...
}
2. Check payment status by relying on Webhook
You can also listen to the payment webhook which Cashfree asynchronously sends once the payment flow has ended.
In cases where the SDK does not provide a callback (e.g., if the user terminates the app or the operating system does not issue the callback to the SDK), the following approach should be taken.
You can start polling the get status API every 20-40 Seconds. You can poll this API from your server till
a. Your TTL, TTL is set from Merchant dashboard. This is usually 2 hours.
b. Cashfree webhook Received. It is advised that you set up Failure/Success/User Dropped webhook from Merchant Dashboard
Subscribe to Developer Updates
Updated 2 months ago