Get All Collection Accounts for Merchants
curl --request GET \
--url https://sandbox.cashfree.com/gc/virtual-accounts \
--header 'x-api-version: <x-api-version>' \
--header 'x-partner-api-key: <x-partner-api-key>' \
--header 'x-partner-merchantid: <x-partner-merchantid>'import requests
url = "https://sandbox.cashfree.com/gc/virtual-accounts"
headers = {
"x-partner-api-key": "<x-partner-api-key>",
"x-partner-merchantid": "<x-partner-merchantid>",
"x-api-version": "<x-api-version>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-partner-api-key': '<x-partner-api-key>',
'x-partner-merchantid': '<x-partner-merchantid>',
'x-api-version': '<x-api-version>'
}
};
fetch('https://sandbox.cashfree.com/gc/virtual-accounts', 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/gc/virtual-accounts",
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-partner-api-key: <x-partner-api-key>",
"x-partner-merchantid: <x-partner-merchantid>"
],
]);
$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/gc/virtual-accounts"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-partner-api-key", "<x-partner-api-key>")
req.Header.Add("x-partner-merchantid", "<x-partner-merchantid>")
req.Header.Add("x-api-version", "<x-api-version>")
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/gc/virtual-accounts")
.header("x-partner-api-key", "<x-partner-api-key>")
.header("x-partner-merchantid", "<x-partner-merchantid>")
.header("x-api-version", "<x-api-version>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/gc/virtual-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-partner-api-key"] = '<x-partner-api-key>'
request["x-partner-merchantid"] = '<x-partner-merchantid>'
request["x-api-version"] = '<x-api-version>'
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"subCode": "200",
"message": "success_message",
"data": {
"totalPages": 1,
"totalElements": 1,
"first": true,
"last": true,
"vAccounts": [
{
"accountName": "John Doe",
"accountNumber": "GB47TCCL12345648154924",
"accountType": "iban",
"paymentType": "priority",
"bankName": "The Currency Cloud Limited",
"bankAddress": "12 Steward Street, The Steward Building, London, E1 6FQ, GB",
"bankCountry": "GB",
"currency": "AUD",
"routingCode": "TCCLGB3L",
"routingCodeType": "bic_swift",
"status": "ACTIVE",
"addedOn": "2023-09-15 16:13:48",
"vaccountId": "GB47T"
}
]
}
}{
"type": "authentication_error",
"message": "failed to authenticate",
"code": "authentication_failed"
}Global Collections
Get Collection Accounts
This API fetches all the virtual accounts that is linked with the given merchant ID.
GET
/
gc
/
virtual-accounts
Get All Collection Accounts for Merchants
curl --request GET \
--url https://sandbox.cashfree.com/gc/virtual-accounts \
--header 'x-api-version: <x-api-version>' \
--header 'x-partner-api-key: <x-partner-api-key>' \
--header 'x-partner-merchantid: <x-partner-merchantid>'import requests
url = "https://sandbox.cashfree.com/gc/virtual-accounts"
headers = {
"x-partner-api-key": "<x-partner-api-key>",
"x-partner-merchantid": "<x-partner-merchantid>",
"x-api-version": "<x-api-version>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-partner-api-key': '<x-partner-api-key>',
'x-partner-merchantid': '<x-partner-merchantid>',
'x-api-version': '<x-api-version>'
}
};
fetch('https://sandbox.cashfree.com/gc/virtual-accounts', 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/gc/virtual-accounts",
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-partner-api-key: <x-partner-api-key>",
"x-partner-merchantid: <x-partner-merchantid>"
],
]);
$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/gc/virtual-accounts"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-partner-api-key", "<x-partner-api-key>")
req.Header.Add("x-partner-merchantid", "<x-partner-merchantid>")
req.Header.Add("x-api-version", "<x-api-version>")
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/gc/virtual-accounts")
.header("x-partner-api-key", "<x-partner-api-key>")
.header("x-partner-merchantid", "<x-partner-merchantid>")
.header("x-api-version", "<x-api-version>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/gc/virtual-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-partner-api-key"] = '<x-partner-api-key>'
request["x-partner-merchantid"] = '<x-partner-merchantid>'
request["x-api-version"] = '<x-api-version>'
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"subCode": "200",
"message": "success_message",
"data": {
"totalPages": 1,
"totalElements": 1,
"first": true,
"last": true,
"vAccounts": [
{
"accountName": "John Doe",
"accountNumber": "GB47TCCL12345648154924",
"accountType": "iban",
"paymentType": "priority",
"bankName": "The Currency Cloud Limited",
"bankAddress": "12 Steward Street, The Steward Building, London, E1 6FQ, GB",
"bankCountry": "GB",
"currency": "AUD",
"routingCode": "TCCLGB3L",
"routingCodeType": "bic_swift",
"status": "ACTIVE",
"addedOn": "2023-09-15 16:13:48",
"vaccountId": "GB47T"
}
]
}
}{
"type": "authentication_error",
"message": "failed to authenticate",
"code": "authentication_failed"
}Based on who you are, consider the below values in the API requests
| Cashfree Merchant | Cashfree Partner |
|---|---|
| x-client-id | x-partner-api-key |
| x-client-secret | x-partner-merchantid |
Headers
Enter partner API keygit
Enter the merchant reference id used while creating merchant during onboarding
API version
Query Parameters
Specify the page number you want to see. The default value is 0.
Specify the page size, the default value is 20.
Please mention the currency for which you want to view virtual account details.
Was this page helpful?
āI