Fetch Subscription Payments
curl --request GET \
--url https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/payments \
--header 'X-Client-Id: <x-client-id>' \
--header 'X-Client-Secret: <x-client-secret>'import requests
url = "https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/payments"
headers = {
"X-Client-Id": "<x-client-id>",
"X-Client-Secret": "<x-client-secret>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-Client-Id': '<x-client-id>', 'X-Client-Secret': '<x-client-secret>'}
};
fetch('https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/payments', 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/api/v2/subscriptions/{subReferenceId}/payments",
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-Client-Id: <x-client-id>",
"X-Client-Secret: <x-client-secret>"
],
]);
$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/api/v2/subscriptions/{subReferenceId}/payments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Client-Id", "<x-client-id>")
req.Header.Add("X-Client-Secret", "<x-client-secret>")
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/api/v2/subscriptions/{subReferenceId}/payments")
.header("X-Client-Id", "<x-client-id>")
.header("X-Client-Secret", "<x-client-secret>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Client-Id"] = '<x-client-id>'
request["X-Client-Secret"] = '<x-client-secret>'
response = http.request(request)
puts response.read_body{
"status": "OK",
"message": "Subscription Payments",
"payments": [
{
"paymentId": 98456,
"cfOrderId": 2571132,
"orderId": "SUB_test_checkout_123_AUTH_98456",
"referenceId": 885308845,
"subReferenceId": 73949,
"currency": "INR",
"amount": 0,
"cycle": 0,
"status": "SUCCESS",
"remarks": "auth payment",
"addedOn": "2022-06-23 15:23:08",
"scheduledOn": null,
"retryAttempts": 0,
"failureReason": null
},
{
"paymentId": 3027901,
"cfOrderId": 647464356,
"orderId": "SUB_AUTH_98456",
"referenceId": 584317815,
"subReferenceId": 2568045,
"currency": "INR",
"amount": 1,
"cycle": 0,
"status": "PENDING",
"remarks": "Scheduled payment",
"addedOn": "2021-10-25 12:33:01",
"scheduledOn": null,
"retryAttempts": 0,
"failureReason": null
},
{
"paymentId": 3027869,
"cfOrderId": 647456025,
"orderId": "SUB_TXN_836464",
"referenceId": 584310425,
"subReferenceId": 2568045,
"currency": "INR",
"amount": 1,
"cycle": 0,
"status": "FAILED",
"addedOn": "2021-10-25 12:26:47",
"scheduledOn": null,
"retryAttempts": 0,
"failureReason": "Update Enrolment failure with MmsApiException"
}
],
"lastId": 3027869
}{
"status": "ERROR",
"subCode": "400",
"message": "Invalid parameters provided"
}{
"status": "ERROR",
"message": "Server encountered an unexpected condition."
}Subscription
Fetch Subscription Payments
Fetch all payments associated with a specific subscription reference ID.
GET
/
api
/
v2
/
subscriptions
/
{subReferenceId}
/
payments
Fetch Subscription Payments
curl --request GET \
--url https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/payments \
--header 'X-Client-Id: <x-client-id>' \
--header 'X-Client-Secret: <x-client-secret>'import requests
url = "https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/payments"
headers = {
"X-Client-Id": "<x-client-id>",
"X-Client-Secret": "<x-client-secret>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-Client-Id': '<x-client-id>', 'X-Client-Secret': '<x-client-secret>'}
};
fetch('https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/payments', 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/api/v2/subscriptions/{subReferenceId}/payments",
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-Client-Id: <x-client-id>",
"X-Client-Secret: <x-client-secret>"
],
]);
$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/api/v2/subscriptions/{subReferenceId}/payments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Client-Id", "<x-client-id>")
req.Header.Add("X-Client-Secret", "<x-client-secret>")
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/api/v2/subscriptions/{subReferenceId}/payments")
.header("X-Client-Id", "<x-client-id>")
.header("X-Client-Secret", "<x-client-secret>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId}/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Client-Id"] = '<x-client-id>'
request["X-Client-Secret"] = '<x-client-secret>'
response = http.request(request)
puts response.read_body{
"status": "OK",
"message": "Subscription Payments",
"payments": [
{
"paymentId": 98456,
"cfOrderId": 2571132,
"orderId": "SUB_test_checkout_123_AUTH_98456",
"referenceId": 885308845,
"subReferenceId": 73949,
"currency": "INR",
"amount": 0,
"cycle": 0,
"status": "SUCCESS",
"remarks": "auth payment",
"addedOn": "2022-06-23 15:23:08",
"scheduledOn": null,
"retryAttempts": 0,
"failureReason": null
},
{
"paymentId": 3027901,
"cfOrderId": 647464356,
"orderId": "SUB_AUTH_98456",
"referenceId": 584317815,
"subReferenceId": 2568045,
"currency": "INR",
"amount": 1,
"cycle": 0,
"status": "PENDING",
"remarks": "Scheduled payment",
"addedOn": "2021-10-25 12:33:01",
"scheduledOn": null,
"retryAttempts": 0,
"failureReason": null
},
{
"paymentId": 3027869,
"cfOrderId": 647456025,
"orderId": "SUB_TXN_836464",
"referenceId": 584310425,
"subReferenceId": 2568045,
"currency": "INR",
"amount": 1,
"cycle": 0,
"status": "FAILED",
"addedOn": "2021-10-25 12:26:47",
"scheduledOn": null,
"retryAttempts": 0,
"failureReason": "Update Enrolment failure with MmsApiException"
}
],
"lastId": 3027869
}{
"status": "ERROR",
"subCode": "400",
"message": "Invalid parameters provided"
}{
"status": "ERROR",
"message": "Server encountered an unexpected condition."
}Headers
Client ID provided by Cashfree.
Example:
"asdf1234"
Client Secret provided by Cashfree.
Example:
"qwer9876"
Path Parameters
The reference ID of the subscription whose payments are to be fetched.
Example:
175124
Query Parameters
The last payment ID from the previous fetch to continue retrieving payments.
Example:
3027869
The number of payments to fetch in the current request.
Example:
3
Response
Successful retrieval of subscription payments.
Was this page helpful?
āI