Get Subscription Details
curl --request GET \
--url https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId} \
--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}"
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}', 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}",
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}"
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}")
.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}")
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 Details",
"subscription": {
"subscriptionId": "SUB-1",
"subReferenceId": 127056,
"planId": "Basic-1",
"customerName": "John Doe",
"customerEmail": "johndoe@gmail.com",
"customerPhone": "9999999999",
"mode": "NPCI_SBC",
"status": "ACTIVE",
"firstChargeDate": null,
"addedOn": "2021-12-16 16:20:52",
"scheduledOn": "2021-12-16 20:30:02",
"currentCycle": 0,
"authLink": "http://cfre.in/t9i2oku",
"bankAccountNumber": "5XXXXXXXXXXXXX",
"bankAccountHolder": "John Doe",
"umrn": "HDFCXXXXXXXXXXXXXXXX",
"splitDetails": {
"scheme": [
{
"merchantVendorId": "test-vendor-1",
"percentage": 10
},
{
"merchantVendorId": "test-vendor-2",
"percentage": 10
}
]
}
}
}Subscription
Get Subscription Details
Fetch the details of a subscription for a specific subscription reference ID.
GET
/
api
/
v2
/
subscriptions
/
{subReferenceId}
Get Subscription Details
curl --request GET \
--url https://sandbox.cashfree.com/api/v2/subscriptions/{subReferenceId} \
--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}"
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}', 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}",
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}"
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}")
.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}")
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 Details",
"subscription": {
"subscriptionId": "SUB-1",
"subReferenceId": 127056,
"planId": "Basic-1",
"customerName": "John Doe",
"customerEmail": "johndoe@gmail.com",
"customerPhone": "9999999999",
"mode": "NPCI_SBC",
"status": "ACTIVE",
"firstChargeDate": null,
"addedOn": "2021-12-16 16:20:52",
"scheduledOn": "2021-12-16 20:30:02",
"currentCycle": 0,
"authLink": "http://cfre.in/t9i2oku",
"bankAccountNumber": "5XXXXXXXXXXXXX",
"bankAccountHolder": "John Doe",
"umrn": "HDFCXXXXXXXXXXXXXXXX",
"splitDetails": {
"scheme": [
{
"merchantVendorId": "test-vendor-1",
"percentage": 10
},
{
"merchantVendorId": "test-vendor-2",
"percentage": 10
}
]
}
}
}Headers
Client ID provided by Cashfree.
Example:
"asdf14"
Client Secret provided by Cashfree.
Example:
"qw9876"
Path Parameters
The reference ID of the subscription whose details are to be fetched.
Example:
127056
Response
Successful retrieval of subscription details.
Was this page helpful?
āI