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 using 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 is asynchronously sent by Cashfree once the payment flow has ended and on receiving the webhook you can initiate a getStatus call.