Simulate funding to mimic scenario when payment hits the virtual account
curl --request POST \
--url https://sandbox.cashfree.com/gc/transactions/emulate \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--header 'x-partner-api-key: <x-partner-api-key>' \
--header 'x-partner-merchantid: <x-partner-merchantid>' \
--data '
{
"vAccountNumber": "<string>",
"amount": "<string>",
"currency": "<string>",
"fundingActions": "<string>",
"remitterAccountNumber": "<string>"
}
'import requests
url = "https://sandbox.cashfree.com/gc/transactions/emulate"
payload = {
"vAccountNumber": "<string>",
"amount": "<string>",
"currency": "<string>",
"fundingActions": "<string>",
"remitterAccountNumber": "<string>"
}
headers = {
"x-partner-api-key": "<x-partner-api-key>",
"x-partner-merchantid": "<x-partner-merchantid>",
"x-api-version": "<x-api-version>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-partner-api-key': '<x-partner-api-key>',
'x-partner-merchantid': '<x-partner-merchantid>',
'x-api-version': '<x-api-version>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
vAccountNumber: '<string>',
amount: '<string>',
currency: '<string>',
fundingActions: '<string>',
remitterAccountNumber: '<string>'
})
};
fetch('https://sandbox.cashfree.com/gc/transactions/emulate', 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/transactions/emulate",
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([
'vAccountNumber' => '<string>',
'amount' => '<string>',
'currency' => '<string>',
'fundingActions' => '<string>',
'remitterAccountNumber' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.cashfree.com/gc/transactions/emulate"
payload := strings.NewReader("{\n \"vAccountNumber\": \"<string>\",\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"fundingActions\": \"<string>\",\n \"remitterAccountNumber\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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>")
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/gc/transactions/emulate")
.header("x-partner-api-key", "<x-partner-api-key>")
.header("x-partner-merchantid", "<x-partner-merchantid>")
.header("x-api-version", "<x-api-version>")
.header("Content-Type", "application/json")
.body("{\n \"vAccountNumber\": \"<string>\",\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"fundingActions\": \"<string>\",\n \"remitterAccountNumber\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/gc/transactions/emulate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"vAccountNumber\": \"<string>\",\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"fundingActions\": \"<string>\",\n \"remitterAccountNumber\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"subCode": "200",
"message": "success_message"
}{
"type": "authentication_error",
"message": "failed to authenticate",
"code": "authentication_failed"
}Global Collections
Simulate Transaction
Use this API to simulate a funding in test environment.
POST
/
gc
/
transactions
/
emulate
Simulate funding to mimic scenario when payment hits the virtual account
curl --request POST \
--url https://sandbox.cashfree.com/gc/transactions/emulate \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--header 'x-partner-api-key: <x-partner-api-key>' \
--header 'x-partner-merchantid: <x-partner-merchantid>' \
--data '
{
"vAccountNumber": "<string>",
"amount": "<string>",
"currency": "<string>",
"fundingActions": "<string>",
"remitterAccountNumber": "<string>"
}
'import requests
url = "https://sandbox.cashfree.com/gc/transactions/emulate"
payload = {
"vAccountNumber": "<string>",
"amount": "<string>",
"currency": "<string>",
"fundingActions": "<string>",
"remitterAccountNumber": "<string>"
}
headers = {
"x-partner-api-key": "<x-partner-api-key>",
"x-partner-merchantid": "<x-partner-merchantid>",
"x-api-version": "<x-api-version>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-partner-api-key': '<x-partner-api-key>',
'x-partner-merchantid': '<x-partner-merchantid>',
'x-api-version': '<x-api-version>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
vAccountNumber: '<string>',
amount: '<string>',
currency: '<string>',
fundingActions: '<string>',
remitterAccountNumber: '<string>'
})
};
fetch('https://sandbox.cashfree.com/gc/transactions/emulate', 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/transactions/emulate",
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([
'vAccountNumber' => '<string>',
'amount' => '<string>',
'currency' => '<string>',
'fundingActions' => '<string>',
'remitterAccountNumber' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.cashfree.com/gc/transactions/emulate"
payload := strings.NewReader("{\n \"vAccountNumber\": \"<string>\",\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"fundingActions\": \"<string>\",\n \"remitterAccountNumber\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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>")
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/gc/transactions/emulate")
.header("x-partner-api-key", "<x-partner-api-key>")
.header("x-partner-merchantid", "<x-partner-merchantid>")
.header("x-api-version", "<x-api-version>")
.header("Content-Type", "application/json")
.body("{\n \"vAccountNumber\": \"<string>\",\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"fundingActions\": \"<string>\",\n \"remitterAccountNumber\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/gc/transactions/emulate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"vAccountNumber\": \"<string>\",\n \"amount\": \"<string>\",\n \"currency\": \"<string>\",\n \"fundingActions\": \"<string>\",\n \"remitterAccountNumber\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"subCode": "200",
"message": "success_message"
}{
"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
Body
application/json
Pass the receiving bank account number for which you want to simulate the funding.
Enter the amount for which the funding has to be simulated.
Enter the three character ISO.
Provide the action you want to do with the funding.
Provide the remitter account number.
Was this page helpful?
āI