curl --request GET \
--url https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id} \
--header 'x-api-version: <x-api-version>' \
--header 'x-client-id: <api-key>' \
--header 'x-client-secret: <api-key>'import requests
url = "https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}"
headers = {
"x-api-version": "<x-api-version>",
"x-client-id": "<api-key>",
"x-client-secret": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-api-version': '<x-api-version>',
'x-client-id': '<api-key>',
'x-client-secret': '<api-key>'
}
};
fetch('https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-version: <x-api-version>",
"x-client-id: <api-key>",
"x-client-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-version", "<x-api-version>")
req.Header.Add("x-client-id", "<api-key>")
req.Header.Add("x-client-secret", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}")
.header("x-api-version", "<x-api-version>")
.header("x-client-id", "<api-key>")
.header("x-client-secret", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-version"] = '<x-api-version>'
request["x-client-id"] = '<api-key>'
request["x-client-secret"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"cf_payment_id": "12376123",
"order_id": "order_8123",
"entity": "payment",
"payment_currency": "INR",
"error_details": null,
"order_amount": 10.01,
"order_currency": "INR",
"is_captured": true,
"payment_group": "upi",
"authorization": {
"action": "CAPTURE",
"status": "PENDING",
"captured_amount": 100,
"start_time": "2022-02-09T18:04:34+05:30",
"end_time": "2022-02-19T18:04:34+05:30",
"approve_by": "2022-02-09T18:04:34+05:30",
"action_reference": "6595231908096894505959",
"action_time": "2022-08-03T16:09:51"
},
"payment_method": {
"upi": {
"channel": "collect",
"upi_id": "rohit@xcxcx",
"upi_payer_ifsc": "AXL1234",
"upi_payer_account_number": "XXXXXXX6024"
}
},
"payment_amount": 10.01,
"payment_time": "2021-07-23T12:15:06+05:30",
"payment_completion_time": "2021-07-23T12:18:59+05:30",
"payment_status": "SUCCESS",
"payment_surcharge": {
"payment_surcharge_service_charge": 0,
"payment_surcharge_service_tax": 0
},
"payment_message": "Transaction successful",
"bank_reference": "P78112898712",
"auth_id": "A898101",
"international_payment": {
"international": false
},
"payment_gateway_details": {
"gateway_name": "CASHFREE",
"gateway_order_id": "1234421ABD",
"gateway_payment_id": "XABDJ2213",
"gateway_order_reference_id": "BDIWO233",
"gateway_settlement": "cashfree",
"gateway_reference_name": ""
}
}Get Payment by ID
Use this API to view payment details of an order for a payment ID.
curl --request GET \
--url https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id} \
--header 'x-api-version: <x-api-version>' \
--header 'x-client-id: <api-key>' \
--header 'x-client-secret: <api-key>'import requests
url = "https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}"
headers = {
"x-api-version": "<x-api-version>",
"x-client-id": "<api-key>",
"x-client-secret": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-api-version': '<x-api-version>',
'x-client-id': '<api-key>',
'x-client-secret': '<api-key>'
}
};
fetch('https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-version: <x-api-version>",
"x-client-id: <api-key>",
"x-client-secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-version", "<x-api-version>")
req.Header.Add("x-client-id", "<api-key>")
req.Header.Add("x-client-secret", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}")
.header("x-api-version", "<x-api-version>")
.header("x-client-id", "<api-key>")
.header("x-client-secret", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/pg/orders/{order_id}/payments/{cf_payment_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-version"] = '<x-api-version>'
request["x-client-id"] = '<api-key>'
request["x-client-secret"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"cf_payment_id": "12376123",
"order_id": "order_8123",
"entity": "payment",
"payment_currency": "INR",
"error_details": null,
"order_amount": 10.01,
"order_currency": "INR",
"is_captured": true,
"payment_group": "upi",
"authorization": {
"action": "CAPTURE",
"status": "PENDING",
"captured_amount": 100,
"start_time": "2022-02-09T18:04:34+05:30",
"end_time": "2022-02-19T18:04:34+05:30",
"approve_by": "2022-02-09T18:04:34+05:30",
"action_reference": "6595231908096894505959",
"action_time": "2022-08-03T16:09:51"
},
"payment_method": {
"upi": {
"channel": "collect",
"upi_id": "rohit@xcxcx",
"upi_payer_ifsc": "AXL1234",
"upi_payer_account_number": "XXXXXXX6024"
}
},
"payment_amount": 10.01,
"payment_time": "2021-07-23T12:15:06+05:30",
"payment_completion_time": "2021-07-23T12:18:59+05:30",
"payment_status": "SUCCESS",
"payment_surcharge": {
"payment_surcharge_service_charge": 0,
"payment_surcharge_service_tax": 0
},
"payment_message": "Transaction successful",
"bank_reference": "P78112898712",
"auth_id": "A898101",
"international_payment": {
"international": false
},
"payment_gateway_details": {
"gateway_name": "CASHFREE",
"gateway_order_id": "1234421ABD",
"gateway_payment_id": "XABDJ2213",
"gateway_order_reference_id": "BDIWO233",
"gateway_settlement": "cashfree",
"gateway_reference_name": ""
}
}Error codes
The following table lists the error codes you may encounter when retrieving payment details for an order using a payment ID:Error codes
Error codes
| Code | Description | Type | Status |
|---|---|---|---|
order_id_invalid | The order_id field contains a value in an invalid format. Provide a correctly formatted order ID and try again. Value received: #INVALID | invalid_request_error | 400 |
order_id_missing | The order_id field is required but was not included in the request. | invalid_request_error | 400 |
version_missing | The version field is required but was not included in the request header. | invalid_request_error | 400 |
payment_id_invalid | The payment_id field must be a numeric value. Value received: INVALID | invalid_request_error | 400 |
payment_get_failed | The payment_id value is out of the supported integer range and cannot be processed. Value received: 100000000000000000000000000000000000000 | invalid_request_error | 400 |
payment_id_missing | The payment_id field is required but was not included in the request. | invalid_request_error | 400 |
payment_not_found | No transaction was found for the specified payment ID. Verify the payment ID and try again. | invalid_request_error | 404 |
order_not_found | No order was found for the specified order reference ID. Verify the order ID and try again. | invalid_request_error | 404 |
Authorizations
Client app ID. You can find your app id in the Merchant Dashboard.
Client secret key. You can find your secret key in the Merchant Dashboard.
Headers
API version to be used.
Request ID for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to Cashfree.
An idempotency key is a unique identifier you include with your API call. If the request fails or times out, you can safely retry it using the same key to avoid duplicate actions.
Path Parameters
The ID which uniquely identifies your order.
The Cashfree payment or transaction ID.
Response
Success response for fetching payment by ID.
Payment entity full object.
The error details are present only for failed payments.
Show child attributes
Show child attributes
{
"error_code": "TRANSACTION_DECLINED",
"error_description": "issuer bank or payment service provider declined the transaction",
"error_reason": "auth_declined",
"error_source": "customer",
"error_code_raw": "ZM",
"error_description_raw": "INVALID / INCORRECT MPIN",
"error_subcode_raw": ""
}
Order amount can be different from payment amount if you collect service fee from the customer.
Type of payment group. One of ['prepaid_card', 'upi_ppi_offline', 'cash', 'upi_credit_card', 'paypal', 'net_banking', 'cardless_emi', 'credit_card', 'bank_transfer', 'pay_later', 'debit_card_emi', 'debit_card', 'wallet', 'upi_ppi', 'upi', 'credit_card_emi'].
This is the time when the payment was initiated.
This is the time when the payment reaches its terminal state.
The transaction status can be one of ["SUCCESS", "NOT_ATTEMPTED", "FAILED", "USER_DROPPED", "VOID", "CANCELLED", "PENDING"].
SUCCESS, NOT_ATTEMPTED, FAILED, USER_DROPPED, VOID, CANCELLED, PENDING Issuing bankās transaction reference number.
Authorisation ID provided by the issuing bank.
If preauth enabled for account you will get this body.
Show child attributes
Show child attributes
{
"action": "CAPTURE",
"status": "PENDING",
"captured_amount": 100,
"start_time": "2022-02-09T18:04:34+05:30",
"end_time": "2022-02-19T18:04:34+05:30",
"approve_by": "2022-02-09T18:04:34+05:30",
"action_reference": "6595231908096894505959",
"action_time": "2022-08-03T16:09:51"
}
The following code samples show the payment method object payload for different payment methods.
- Card
- Net banking
- UPI
- App
- Cardless EMI
- Pay later
- Card EMI
- Bank transfer
Show child attributes
Show child attributes
International payment details.
Show child attributes
Show child attributes
payment gateway details present in the webhook response.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?