Skip to main content
POST
/
gc
/
transactions
/
{referenceId}
/
invoice-details
Add Transaction Details for Partner Merchants
curl --request POST \
  --url https://sandbox.cashfree.com/gc/transactions/{referenceId}/invoice-details \
  --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 '
{
  "invoiceNumber": "<string>",
  "invoiceAmount": "<string>",
  "invoiceFile": "<string>",
  "remitterName": "<string>",
  "purposeCode": "<string>"
}
'
import requests

url = "https://sandbox.cashfree.com/gc/transactions/{referenceId}/invoice-details"

payload = {
"invoiceNumber": "<string>",
"invoiceAmount": "<string>",
"invoiceFile": "<string>",
"remitterName": "<string>",
"purposeCode": "<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({
invoiceNumber: '<string>',
invoiceAmount: '<string>',
invoiceFile: '<string>',
remitterName: '<string>',
purposeCode: '<string>'
})
};

fetch('https://sandbox.cashfree.com/gc/transactions/{referenceId}/invoice-details', 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/{referenceId}/invoice-details",
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([
'invoiceNumber' => '<string>',
'invoiceAmount' => '<string>',
'invoiceFile' => '<string>',
'remitterName' => '<string>',
'purposeCode' => '<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/{referenceId}/invoice-details"

payload := strings.NewReader("{\n \"invoiceNumber\": \"<string>\",\n \"invoiceAmount\": \"<string>\",\n \"invoiceFile\": \"<string>\",\n \"remitterName\": \"<string>\",\n \"purposeCode\": \"<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/{referenceId}/invoice-details")
.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 \"invoiceNumber\": \"<string>\",\n \"invoiceAmount\": \"<string>\",\n \"invoiceFile\": \"<string>\",\n \"remitterName\": \"<string>\",\n \"purposeCode\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://sandbox.cashfree.com/gc/transactions/{referenceId}/invoice-details")

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 \"invoiceNumber\": \"<string>\",\n \"invoiceAmount\": \"<string>\",\n \"invoiceFile\": \"<string>\",\n \"remitterName\": \"<string>\",\n \"purposeCode\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "cmsProfileId": 23802472,
  "cmsPaymentId": 310729,
  "invoiceNumber": "ABC123",
  "invoiceAmount": 1,
  "remitterName": "remitter",
  "status": "SUCCESS"
}
{
"title": "PAYMENT_NOT_FOUND",
"detail": "Payment with ID 11111 could not be found."
}
{
"type": "authentication_error",
"message": "failed to authenticate",
"code": "authentication_failed"
}
Based on who you are, consider the below values in the API requests
Cashfree MerchantCashfree Partner
x-client-idx-partner-api-key
x-client-secretx-partner-merchantid

Headers

x-partner-api-key
string
required

Enter partner API keygit

x-partner-merchantid
string
required

Enter the merchant reference id used while creating merchant during onboarding

x-api-version
string
required

API version

Path Parameters

referenceId
string
required

Body

application/json
invoiceNumber
string
required
invoiceAmount
string
required
invoiceFile
file
required
remitterName
string
required
purposeCode
string

Response

Success response for adding invoice details.

cmsProfileId
integer
Example:

23802472

cmsPaymentId
integer
Example:

310729

invoiceNumber
string
Example:

"ABC123"

invoiceAmount
integer
Example:

1

remitterName
string
Example:

"remitter"

status
string
Example:

"SUCCESS"