Skip to main content
POST
/
fundsources
/
connected
/
virtual-account
Create Virtual Account
curl --request POST \
  --url https://sandbox.cashfree.com/payout/fundsources/connected/virtual-account \
  --header 'Content-Type: application/json' \
  --data '
{
  "displayName": "Demo1",
  "accountPrefix": 1234
}
'
import requests

url = "https://sandbox.cashfree.com/payout/fundsources/connected/virtual-account"

payload = {
"displayName": "Demo1",
"accountPrefix": 1234
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({displayName: 'Demo1', accountPrefix: 1234})
};

fetch('https://sandbox.cashfree.com/payout/fundsources/connected/virtual-account', 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/payout/fundsources/connected/virtual-account",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'displayName' => 'Demo1',
'accountPrefix' => 1234
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://sandbox.cashfree.com/payout/fundsources/connected/virtual-account"

payload := strings.NewReader("{\n \"displayName\": \"Demo1\",\n \"accountPrefix\": 1234\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://sandbox.cashfree.com/payout/fundsources/connected/virtual-account")
.header("Content-Type", "application/json")
.body("{\n \"displayName\": \"Demo1\",\n \"accountPrefix\": 1234\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://sandbox.cashfree.com/payout/fundsources/connected/virtual-account")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"displayName\": \"Demo1\",\n \"accountPrefix\": 1234\n}"

response = http.request(request)
puts response.read_body
{
  "status": "SUCCESS",
  "subCode": "200",
  "message": "Virtual account created",
  "data": {
    "paymentInstrumentId": "KOTAKCR_CONNECTED_376933_9e478d1",
    "virtualAccountNumber": "90909010KR0M"
  }
}

Body

application/json

Find the request parameters to create the virtual account

displayName
string
required

It is the name you want to display for the virtual account.

Example:

"Demo1"

accountPrefix
string

It is the account prefix as allocated by the bank. This paramete is mandatory during the first account creation.

Example:

1234

Response

Virtual account successfully created.

status
string

It displays the status of the request (SUCCESS/FAILURE).

Example:

"SUCCESS"

subCode
string

It displays the sub code of the request.

Example:

"200"

message
string

It displays the outcome of the request.

Example:

"FundSource Details Retrieved"

data
object

Response data.