Step 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-
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
Call GET status APIs from backend as this API uses your secret key.
2. Use Payment Callbacks to verify the payment
Refer Payment Callback
Recommendation
The ideal workflow to verify payment status should involve polling the get Status API. However, you can also listen to the payment webhook which is asynchronously sent by Cashfree and on receiving the webhook you can initiate a getStatus call.
This method is the most secure way to verify payment status and even avoids cases where some malicious actor has a hold of your keys.
Updated about 1 year ago