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: "2022-01-01"'
'https://sandbox.cashfree.com/pg/orders/{order_id}'
{
  "cf_order_id": 1553338,
  "order_id": "order_271vovQ3PTZAx3fDI0",
  "entity": "order",
  "order_currency": "INR",
  "order_amount": 10.12,
  "order_status": "ACTIVE",
  "order_token": "79byj5123g6912mki3",
  "order_note": "order #145",
  "order_expiry_time": "2021-07-29T05:30:00+05:30",
  "payment_link": "https://payments-test.cashfree.com/order#123bhd816dfb1"
}

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.