curl --request POST \
--url https://sandbox.cashfree.com/pg/links \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--header 'x-client-id: <api-key>' \
--header 'x-client-secret: <api-key>' \
--data '
{
"customer_details": {
"customer_email": "john@cashfree.com",
"customer_name": "John Doe",
"customer_phone": "9999999999"
},
"link_amount": 100,
"link_auto_reminders": true,
"link_currency": "INR",
"link_expiry_time": "2021-10-14T15:04:05+05:30",
"link_id": "my_link_id",
"link_meta": {
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
"return_url": "https://www.cashfree.com/devstudio/thankyou",
"upi_intent": false
},
"link_minimum_partial_amount": 20,
"link_notes": {
"key_1": "value_1",
"key_2": "value_2"
},
"link_notify": {
"send_email": true,
"send_sms": false
},
"link_partial_payments": true,
"link_purpose": "Payment for PlayStation 11",
"order_splits": [
{
"vendor_id": "Jane",
"amount": 1.45,
"tags": {
"address": "Hyderabad"
}
},
{
"vendor_id": "Barbie",
"amount": 3.45,
"tags": {
"address": "Bengaluru, India"
}
}
],
"enable_invoice": true
}
'import requests
url = "https://sandbox.cashfree.com/pg/links"
payload = {
"customer_details": {
"customer_email": "john@cashfree.com",
"customer_name": "John Doe",
"customer_phone": "9999999999"
},
"link_amount": 100,
"link_auto_reminders": True,
"link_currency": "INR",
"link_expiry_time": "2021-10-14T15:04:05+05:30",
"link_id": "my_link_id",
"link_meta": {
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
"return_url": "https://www.cashfree.com/devstudio/thankyou",
"upi_intent": False
},
"link_minimum_partial_amount": 20,
"link_notes": {
"key_1": "value_1",
"key_2": "value_2"
},
"link_notify": {
"send_email": True,
"send_sms": False
},
"link_partial_payments": True,
"link_purpose": "Payment for PlayStation 11",
"order_splits": [
{
"vendor_id": "Jane",
"amount": 1.45,
"tags": { "address": "Hyderabad" }
},
{
"vendor_id": "Barbie",
"amount": 3.45,
"tags": { "address": "Bengaluru, India" }
}
],
"enable_invoice": True
}
headers = {
"x-api-version": "<x-api-version>",
"x-client-id": "<api-key>",
"x-client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-version': '<x-api-version>',
'x-client-id': '<api-key>',
'x-client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customer_details: {
customer_email: 'john@cashfree.com',
customer_name: 'John Doe',
customer_phone: '9999999999'
},
link_amount: 100,
link_auto_reminders: true,
link_currency: 'INR',
link_expiry_time: '2021-10-14T15:04:05+05:30',
link_id: 'my_link_id',
link_meta: {
notify_url: 'https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net',
return_url: 'https://www.cashfree.com/devstudio/thankyou',
upi_intent: false
},
link_minimum_partial_amount: 20,
link_notes: {key_1: 'value_1', key_2: 'value_2'},
link_notify: {send_email: true, send_sms: false},
link_partial_payments: true,
link_purpose: 'Payment for PlayStation 11',
order_splits: [
{vendor_id: 'Jane', amount: 1.45, tags: {address: 'Hyderabad'}},
{vendor_id: 'Barbie', amount: 3.45, tags: {address: 'Bengaluru, India'}}
],
enable_invoice: true
})
};
fetch('https://sandbox.cashfree.com/pg/links', 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/pg/links",
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([
'customer_details' => [
'customer_email' => 'john@cashfree.com',
'customer_name' => 'John Doe',
'customer_phone' => '9999999999'
],
'link_amount' => 100,
'link_auto_reminders' => true,
'link_currency' => 'INR',
'link_expiry_time' => '2021-10-14T15:04:05+05:30',
'link_id' => 'my_link_id',
'link_meta' => [
'notify_url' => 'https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net',
'return_url' => 'https://www.cashfree.com/devstudio/thankyou',
'upi_intent' => false
],
'link_minimum_partial_amount' => 20,
'link_notes' => [
'key_1' => 'value_1',
'key_2' => 'value_2'
],
'link_notify' => [
'send_email' => true,
'send_sms' => false
],
'link_partial_payments' => true,
'link_purpose' => 'Payment for PlayStation 11',
'order_splits' => [
[
'vendor_id' => 'Jane',
'amount' => 1.45,
'tags' => [
'address' => 'Hyderabad'
]
],
[
'vendor_id' => 'Barbie',
'amount' => 3.45,
'tags' => [
'address' => 'Bengaluru, India'
]
]
],
'enable_invoice' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-version: <x-api-version>",
"x-client-id: <api-key>",
"x-client-secret: <api-key>"
],
]);
$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/pg/links"
payload := strings.NewReader("{\n \"customer_details\": {\n \"customer_email\": \"john@cashfree.com\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"9999999999\"\n },\n \"link_amount\": 100,\n \"link_auto_reminders\": true,\n \"link_currency\": \"INR\",\n \"link_expiry_time\": \"2021-10-14T15:04:05+05:30\",\n \"link_id\": \"my_link_id\",\n \"link_meta\": {\n \"notify_url\": \"https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net\",\n \"return_url\": \"https://www.cashfree.com/devstudio/thankyou\",\n \"upi_intent\": false\n },\n \"link_minimum_partial_amount\": 20,\n \"link_notes\": {\n \"key_1\": \"value_1\",\n \"key_2\": \"value_2\"\n },\n \"link_notify\": {\n \"send_email\": true,\n \"send_sms\": false\n },\n \"link_partial_payments\": true,\n \"link_purpose\": \"Payment for PlayStation 11\",\n \"order_splits\": [\n {\n \"vendor_id\": \"Jane\",\n \"amount\": 1.45,\n \"tags\": {\n \"address\": \"Hyderabad\"\n }\n },\n {\n \"vendor_id\": \"Barbie\",\n \"amount\": 3.45,\n \"tags\": {\n \"address\": \"Bengaluru, India\"\n }\n }\n ],\n \"enable_invoice\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-version", "<x-api-version>")
req.Header.Add("x-client-id", "<api-key>")
req.Header.Add("x-client-secret", "<api-key>")
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/pg/links")
.header("x-api-version", "<x-api-version>")
.header("x-client-id", "<api-key>")
.header("x-client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_details\": {\n \"customer_email\": \"john@cashfree.com\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"9999999999\"\n },\n \"link_amount\": 100,\n \"link_auto_reminders\": true,\n \"link_currency\": \"INR\",\n \"link_expiry_time\": \"2021-10-14T15:04:05+05:30\",\n \"link_id\": \"my_link_id\",\n \"link_meta\": {\n \"notify_url\": \"https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net\",\n \"return_url\": \"https://www.cashfree.com/devstudio/thankyou\",\n \"upi_intent\": false\n },\n \"link_minimum_partial_amount\": 20,\n \"link_notes\": {\n \"key_1\": \"value_1\",\n \"key_2\": \"value_2\"\n },\n \"link_notify\": {\n \"send_email\": true,\n \"send_sms\": false\n },\n \"link_partial_payments\": true,\n \"link_purpose\": \"Payment for PlayStation 11\",\n \"order_splits\": [\n {\n \"vendor_id\": \"Jane\",\n \"amount\": 1.45,\n \"tags\": {\n \"address\": \"Hyderabad\"\n }\n },\n {\n \"vendor_id\": \"Barbie\",\n \"amount\": 3.45,\n \"tags\": {\n \"address\": \"Bengaluru, India\"\n }\n }\n ],\n \"enable_invoice\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/pg/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-version"] = '<x-api-version>'
request["x-client-id"] = '<api-key>'
request["x-client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_details\": {\n \"customer_email\": \"john@cashfree.com\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"9999999999\"\n },\n \"link_amount\": 100,\n \"link_auto_reminders\": true,\n \"link_currency\": \"INR\",\n \"link_expiry_time\": \"2021-10-14T15:04:05+05:30\",\n \"link_id\": \"my_link_id\",\n \"link_meta\": {\n \"notify_url\": \"https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net\",\n \"return_url\": \"https://www.cashfree.com/devstudio/thankyou\",\n \"upi_intent\": false\n },\n \"link_minimum_partial_amount\": 20,\n \"link_notes\": {\n \"key_1\": \"value_1\",\n \"key_2\": \"value_2\"\n },\n \"link_notify\": {\n \"send_email\": true,\n \"send_sms\": false\n },\n \"link_partial_payments\": true,\n \"link_purpose\": \"Payment for PlayStation 11\",\n \"order_splits\": [\n {\n \"vendor_id\": \"Jane\",\n \"amount\": 1.45,\n \"tags\": {\n \"address\": \"Hyderabad\"\n }\n },\n {\n \"vendor_id\": \"Barbie\",\n \"amount\": 3.45,\n \"tags\": {\n \"address\": \"Bengaluru, India\"\n }\n }\n ],\n \"enable_invoice\": true\n}"
response = http.request(request)
puts response.read_body{
"cf_link_id": "1996567",
"link_id": "my_link_id",
"link_status": "ACTIVE",
"link_currency": "INR",
"link_amount": 100,
"link_amount_paid": 0,
"link_partial_payments": true,
"link_minimum_partial_amount": 20,
"link_purpose": "Payment for PlayStation 11",
"link_created_at": "2021-09-30T17:05:01+05:30",
"customer_details": {
"customer_name": "John Doe",
"customer_phone": "9999999999",
"customer_email": "john@example.com"
},
"link_meta": {
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
"upi_intent": false,
"return_url": "https://www.cashfree.com/devstudio/thankyou"
},
"link_url": "https://payments-test.cashfree.com/links/o1tf1nvcvjhg",
"link_expiry_time": "2021-10-14T15:04:05+05:30",
"link_notes": {
"key_1": "value_1",
"key_2": "value_2"
},
"link_auto_reminders": true,
"link_qrcode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFAAQMAAAD3XjfpAAAABlBMVEX///8AAABVwtN+AAAC9ElEQVR4nOyaPY7jMAyFn6HCpY7go/hmkXIzH0VHUOlC8Fvw0c4kM4PFFltJJjDAQPnSEPx5JIPbbrvttv9rC82mPW7gvnDasT5ZkSZyS/ZR6xLMANaJFQLJuj5J5mkHHgaMDpJlNfeROzAZFE4/PgKZOwZfoWTggchsDrvBd7DNZeW/+LEHUDmzY7Wn1aNHORO335JrNPBVcVPYl+2Y6/pssSS9/F6aOwDdLq9smLkBsUCl9aeNB6riymMzNwujI9QlW11hw/Lmx47AJVNBY16Zi71Ydy1JFTXU4UEGlvWYSfsGgbghXOn2HkGdgcCymdJS9GCu66HXmVtqsQwOvoSo/tnswbovLZ6mFpnHBpccTLHaPGMq5QBWKznZOpN9PbUeQcCdUV1mmFfkHmqcI4nBweZt2Ifc031SbEifrbgnMClndg8aWknJ1l5cpLlgHRp0OaZ5xiY4qRQPI5Our3mmO7Cs3L37mhp1SaYBNtRP9wwJnsll84zWYTmwJO5qOCV1CdpoT9pQkkykWWuResdccY22A4NIZIGmF2i4qesRXLBbcpWvNtwTuDCc7SWf0tTay6LVZ3ovpKOClkYHbHrZsU575LOddfiBD2XfFdhMhJozgo31NsXBFem35BoSlPjY9LkJdswkWywJEmmfWdgPeMqt64akQtr0Gj8XgKOCvubxjehmfszXaD992wH0AyL5BGZ9xqIHkU+eihRX9xkX9C2fSzKVFJtXouSITitvS8AhwSzBLm2mM6RmGoDaJfMtHvsC1YavzbD344pXxR0eNG1m8jx5yVHFNT9GBU/uEnSzDMnNSq8KLaATG0L9OiyOCfoFUn5sM7fj2gy/ztLoEtS12f6yqshc8Qj13AKFd202KHheIF2bQWseFkxKrrp8/6VLV+Au8cFNqYJYkrXZZ4s/f98zJEiPFd3gU9PPdij1/rEO6whUzsxnmug24gez6DkzOPiquAg+ztEX57rK1+WX0twBeNttt932d/sTAAD//zUdVfZhwUvzAAAAAElFTkSuQmCC",
"link_notify": {
"send_sms": false,
"send_email": true
},
"order_splits": [
{
"vendor_id": "Jane",
"percentage": 10,
"tags": {
"address": "Hyderabad"
}
},
{
"vendor_id": "Barbie",
"percentage": 50,
"tags": {
"address": "Bengaluru, India"
}
}
]
}{
"message": "bad URL, please check API documentation",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "request_failed",
"type": "invalid_request_error"
}{
"message": "authentication Failed",
"code": "request_failed",
"type": "authentication_error"
}{
"message": "something is not found",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "something_not_found",
"type": "invalid_request_error"
}{
"message": "order with same id is already present",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "order_already_exists",
"type": "invalid_request_error"
}{
"message": "something is not found",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "request_invalid",
"type": "idempotency_error"
}{
"message": "Too many requests from IP. Check headers",
"code": "request_failed",
"type": "rate_limit_error"
}{
"message": "internal Server Error",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "internal_error",
"type": "api_error"
}Create Payment Link
Use this API to create a new payment link. The created payment link url will be available in the API response parameter link_url.
curl --request POST \
--url https://sandbox.cashfree.com/pg/links \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--header 'x-client-id: <api-key>' \
--header 'x-client-secret: <api-key>' \
--data '
{
"customer_details": {
"customer_email": "john@cashfree.com",
"customer_name": "John Doe",
"customer_phone": "9999999999"
},
"link_amount": 100,
"link_auto_reminders": true,
"link_currency": "INR",
"link_expiry_time": "2021-10-14T15:04:05+05:30",
"link_id": "my_link_id",
"link_meta": {
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
"return_url": "https://www.cashfree.com/devstudio/thankyou",
"upi_intent": false
},
"link_minimum_partial_amount": 20,
"link_notes": {
"key_1": "value_1",
"key_2": "value_2"
},
"link_notify": {
"send_email": true,
"send_sms": false
},
"link_partial_payments": true,
"link_purpose": "Payment for PlayStation 11",
"order_splits": [
{
"vendor_id": "Jane",
"amount": 1.45,
"tags": {
"address": "Hyderabad"
}
},
{
"vendor_id": "Barbie",
"amount": 3.45,
"tags": {
"address": "Bengaluru, India"
}
}
],
"enable_invoice": true
}
'import requests
url = "https://sandbox.cashfree.com/pg/links"
payload = {
"customer_details": {
"customer_email": "john@cashfree.com",
"customer_name": "John Doe",
"customer_phone": "9999999999"
},
"link_amount": 100,
"link_auto_reminders": True,
"link_currency": "INR",
"link_expiry_time": "2021-10-14T15:04:05+05:30",
"link_id": "my_link_id",
"link_meta": {
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
"return_url": "https://www.cashfree.com/devstudio/thankyou",
"upi_intent": False
},
"link_minimum_partial_amount": 20,
"link_notes": {
"key_1": "value_1",
"key_2": "value_2"
},
"link_notify": {
"send_email": True,
"send_sms": False
},
"link_partial_payments": True,
"link_purpose": "Payment for PlayStation 11",
"order_splits": [
{
"vendor_id": "Jane",
"amount": 1.45,
"tags": { "address": "Hyderabad" }
},
{
"vendor_id": "Barbie",
"amount": 3.45,
"tags": { "address": "Bengaluru, India" }
}
],
"enable_invoice": True
}
headers = {
"x-api-version": "<x-api-version>",
"x-client-id": "<api-key>",
"x-client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-version': '<x-api-version>',
'x-client-id': '<api-key>',
'x-client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customer_details: {
customer_email: 'john@cashfree.com',
customer_name: 'John Doe',
customer_phone: '9999999999'
},
link_amount: 100,
link_auto_reminders: true,
link_currency: 'INR',
link_expiry_time: '2021-10-14T15:04:05+05:30',
link_id: 'my_link_id',
link_meta: {
notify_url: 'https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net',
return_url: 'https://www.cashfree.com/devstudio/thankyou',
upi_intent: false
},
link_minimum_partial_amount: 20,
link_notes: {key_1: 'value_1', key_2: 'value_2'},
link_notify: {send_email: true, send_sms: false},
link_partial_payments: true,
link_purpose: 'Payment for PlayStation 11',
order_splits: [
{vendor_id: 'Jane', amount: 1.45, tags: {address: 'Hyderabad'}},
{vendor_id: 'Barbie', amount: 3.45, tags: {address: 'Bengaluru, India'}}
],
enable_invoice: true
})
};
fetch('https://sandbox.cashfree.com/pg/links', 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/pg/links",
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([
'customer_details' => [
'customer_email' => 'john@cashfree.com',
'customer_name' => 'John Doe',
'customer_phone' => '9999999999'
],
'link_amount' => 100,
'link_auto_reminders' => true,
'link_currency' => 'INR',
'link_expiry_time' => '2021-10-14T15:04:05+05:30',
'link_id' => 'my_link_id',
'link_meta' => [
'notify_url' => 'https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net',
'return_url' => 'https://www.cashfree.com/devstudio/thankyou',
'upi_intent' => false
],
'link_minimum_partial_amount' => 20,
'link_notes' => [
'key_1' => 'value_1',
'key_2' => 'value_2'
],
'link_notify' => [
'send_email' => true,
'send_sms' => false
],
'link_partial_payments' => true,
'link_purpose' => 'Payment for PlayStation 11',
'order_splits' => [
[
'vendor_id' => 'Jane',
'amount' => 1.45,
'tags' => [
'address' => 'Hyderabad'
]
],
[
'vendor_id' => 'Barbie',
'amount' => 3.45,
'tags' => [
'address' => 'Bengaluru, India'
]
]
],
'enable_invoice' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-version: <x-api-version>",
"x-client-id: <api-key>",
"x-client-secret: <api-key>"
],
]);
$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/pg/links"
payload := strings.NewReader("{\n \"customer_details\": {\n \"customer_email\": \"john@cashfree.com\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"9999999999\"\n },\n \"link_amount\": 100,\n \"link_auto_reminders\": true,\n \"link_currency\": \"INR\",\n \"link_expiry_time\": \"2021-10-14T15:04:05+05:30\",\n \"link_id\": \"my_link_id\",\n \"link_meta\": {\n \"notify_url\": \"https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net\",\n \"return_url\": \"https://www.cashfree.com/devstudio/thankyou\",\n \"upi_intent\": false\n },\n \"link_minimum_partial_amount\": 20,\n \"link_notes\": {\n \"key_1\": \"value_1\",\n \"key_2\": \"value_2\"\n },\n \"link_notify\": {\n \"send_email\": true,\n \"send_sms\": false\n },\n \"link_partial_payments\": true,\n \"link_purpose\": \"Payment for PlayStation 11\",\n \"order_splits\": [\n {\n \"vendor_id\": \"Jane\",\n \"amount\": 1.45,\n \"tags\": {\n \"address\": \"Hyderabad\"\n }\n },\n {\n \"vendor_id\": \"Barbie\",\n \"amount\": 3.45,\n \"tags\": {\n \"address\": \"Bengaluru, India\"\n }\n }\n ],\n \"enable_invoice\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-version", "<x-api-version>")
req.Header.Add("x-client-id", "<api-key>")
req.Header.Add("x-client-secret", "<api-key>")
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/pg/links")
.header("x-api-version", "<x-api-version>")
.header("x-client-id", "<api-key>")
.header("x-client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_details\": {\n \"customer_email\": \"john@cashfree.com\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"9999999999\"\n },\n \"link_amount\": 100,\n \"link_auto_reminders\": true,\n \"link_currency\": \"INR\",\n \"link_expiry_time\": \"2021-10-14T15:04:05+05:30\",\n \"link_id\": \"my_link_id\",\n \"link_meta\": {\n \"notify_url\": \"https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net\",\n \"return_url\": \"https://www.cashfree.com/devstudio/thankyou\",\n \"upi_intent\": false\n },\n \"link_minimum_partial_amount\": 20,\n \"link_notes\": {\n \"key_1\": \"value_1\",\n \"key_2\": \"value_2\"\n },\n \"link_notify\": {\n \"send_email\": true,\n \"send_sms\": false\n },\n \"link_partial_payments\": true,\n \"link_purpose\": \"Payment for PlayStation 11\",\n \"order_splits\": [\n {\n \"vendor_id\": \"Jane\",\n \"amount\": 1.45,\n \"tags\": {\n \"address\": \"Hyderabad\"\n }\n },\n {\n \"vendor_id\": \"Barbie\",\n \"amount\": 3.45,\n \"tags\": {\n \"address\": \"Bengaluru, India\"\n }\n }\n ],\n \"enable_invoice\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.cashfree.com/pg/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-version"] = '<x-api-version>'
request["x-client-id"] = '<api-key>'
request["x-client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_details\": {\n \"customer_email\": \"john@cashfree.com\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"9999999999\"\n },\n \"link_amount\": 100,\n \"link_auto_reminders\": true,\n \"link_currency\": \"INR\",\n \"link_expiry_time\": \"2021-10-14T15:04:05+05:30\",\n \"link_id\": \"my_link_id\",\n \"link_meta\": {\n \"notify_url\": \"https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net\",\n \"return_url\": \"https://www.cashfree.com/devstudio/thankyou\",\n \"upi_intent\": false\n },\n \"link_minimum_partial_amount\": 20,\n \"link_notes\": {\n \"key_1\": \"value_1\",\n \"key_2\": \"value_2\"\n },\n \"link_notify\": {\n \"send_email\": true,\n \"send_sms\": false\n },\n \"link_partial_payments\": true,\n \"link_purpose\": \"Payment for PlayStation 11\",\n \"order_splits\": [\n {\n \"vendor_id\": \"Jane\",\n \"amount\": 1.45,\n \"tags\": {\n \"address\": \"Hyderabad\"\n }\n },\n {\n \"vendor_id\": \"Barbie\",\n \"amount\": 3.45,\n \"tags\": {\n \"address\": \"Bengaluru, India\"\n }\n }\n ],\n \"enable_invoice\": true\n}"
response = http.request(request)
puts response.read_body{
"cf_link_id": "1996567",
"link_id": "my_link_id",
"link_status": "ACTIVE",
"link_currency": "INR",
"link_amount": 100,
"link_amount_paid": 0,
"link_partial_payments": true,
"link_minimum_partial_amount": 20,
"link_purpose": "Payment for PlayStation 11",
"link_created_at": "2021-09-30T17:05:01+05:30",
"customer_details": {
"customer_name": "John Doe",
"customer_phone": "9999999999",
"customer_email": "john@example.com"
},
"link_meta": {
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
"upi_intent": false,
"return_url": "https://www.cashfree.com/devstudio/thankyou"
},
"link_url": "https://payments-test.cashfree.com/links/o1tf1nvcvjhg",
"link_expiry_time": "2021-10-14T15:04:05+05:30",
"link_notes": {
"key_1": "value_1",
"key_2": "value_2"
},
"link_auto_reminders": true,
"link_qrcode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFAAQMAAAD3XjfpAAAABlBMVEX///8AAABVwtN+AAAC9ElEQVR4nOyaPY7jMAyFn6HCpY7go/hmkXIzH0VHUOlC8Fvw0c4kM4PFFltJJjDAQPnSEPx5JIPbbrvttv9rC82mPW7gvnDasT5ZkSZyS/ZR6xLMANaJFQLJuj5J5mkHHgaMDpJlNfeROzAZFE4/PgKZOwZfoWTggchsDrvBd7DNZeW/+LEHUDmzY7Wn1aNHORO335JrNPBVcVPYl+2Y6/pssSS9/F6aOwDdLq9smLkBsUCl9aeNB6riymMzNwujI9QlW11hw/Lmx47AJVNBY16Zi71Ydy1JFTXU4UEGlvWYSfsGgbghXOn2HkGdgcCymdJS9GCu66HXmVtqsQwOvoSo/tnswbovLZ6mFpnHBpccTLHaPGMq5QBWKznZOpN9PbUeQcCdUV1mmFfkHmqcI4nBweZt2Ifc031SbEifrbgnMClndg8aWknJ1l5cpLlgHRp0OaZ5xiY4qRQPI5Our3mmO7Cs3L37mhp1SaYBNtRP9wwJnsll84zWYTmwJO5qOCV1CdpoT9pQkkykWWuResdccY22A4NIZIGmF2i4qesRXLBbcpWvNtwTuDCc7SWf0tTay6LVZ3ovpKOClkYHbHrZsU575LOddfiBD2XfFdhMhJozgo31NsXBFem35BoSlPjY9LkJdswkWywJEmmfWdgPeMqt64akQtr0Gj8XgKOCvubxjehmfszXaD992wH0AyL5BGZ9xqIHkU+eihRX9xkX9C2fSzKVFJtXouSITitvS8AhwSzBLm2mM6RmGoDaJfMtHvsC1YavzbD344pXxR0eNG1m8jx5yVHFNT9GBU/uEnSzDMnNSq8KLaATG0L9OiyOCfoFUn5sM7fj2gy/ztLoEtS12f6yqshc8Qj13AKFd202KHheIF2bQWseFkxKrrp8/6VLV+Au8cFNqYJYkrXZZ4s/f98zJEiPFd3gU9PPdij1/rEO6whUzsxnmug24gez6DkzOPiquAg+ztEX57rK1+WX0twBeNttt932d/sTAAD//zUdVfZhwUvzAAAAAElFTkSuQmCC",
"link_notify": {
"send_sms": false,
"send_email": true
},
"order_splits": [
{
"vendor_id": "Jane",
"percentage": 10,
"tags": {
"address": "Hyderabad"
}
},
{
"vendor_id": "Barbie",
"percentage": 50,
"tags": {
"address": "Bengaluru, India"
}
}
]
}{
"message": "bad URL, please check API documentation",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "request_failed",
"type": "invalid_request_error"
}{
"message": "authentication Failed",
"code": "request_failed",
"type": "authentication_error"
}{
"message": "something is not found",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "something_not_found",
"type": "invalid_request_error"
}{
"message": "order with same id is already present",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "order_already_exists",
"type": "invalid_request_error"
}{
"message": "something is not found",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "request_invalid",
"type": "idempotency_error"
}{
"message": "Too many requests from IP. Check headers",
"code": "request_failed",
"type": "rate_limit_error"
}{
"message": "internal Server Error",
"help": "Check latest errors and resolution from Merchant Dashboard API logs: https://bit.ly/4glEd0W Help Document: https://bit.ly/4eeZYO9",
"code": "internal_error",
"type": "api_error"
}Authorizations
Client app ID. You can find your app id in the Merchant Dashboard.
Client secret key. You can find your secret key in the Merchant Dashboard.
Headers
API version to be used.
Request ID for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to Cashfree.
An idempotency key is a unique identifier you include with your API call. If the request fails or times out, you can safely retry it using the same key to avoid duplicate actions.
Body
Request parameters to create a new payment link.
Amount to be collected using this link. Provide upto two decimals for paise.
Currency for the payment link. Default is INR. Submit Support Form to enable new currencies.
A brief description for which payment must be collected. This is shown to the customer.
500Payment link customer entity.
Show child attributes
Show child attributes
{
"customer_name": "John Doe",
"customer_phone": "9999999999",
"customer_email": "john@cashfree.com",
"customer_bank_account_number": 11111111111,
"customer_bank_ifsc": "SBIN0001882",
"customer_bank_code": 7001
}
Unique Identifier (provided by merchant) for the Link. Alphanumeric and only - and _ allowed (50 character limit). Use this for other link-related APIs.
50If "true", customer can make partial payments for the link.
Minimum amount in first installment that needs to be paid by the customer if partial payments are enabled. This should be less than the link_amount.
Time after which the link expires. Customers will not be able to make the payment beyond the time specified here. You can provide them in a valid ISO 8601 time format. Default is 30 days.
Payment link Notify Object for SMS and Email.
Show child attributes
Show child attributes
{ "send_sms": false, "send_email": true }
If "true", reminders will be sent to customers for collecting payments.
Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs.
Show child attributes
Show child attributes
{ "key_1": "value_1", "key_2": "value_2" }
Payment link meta information object.
Show child attributes
Show child attributes
{
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
"upi_intent": "false",
"return_url": "https://www.cashfree.com/devstudio/thankyou"
}
If you have Easy split enabled in your Cashfree account then you can use this option to split the order amount.
Show child attributes
Show child attributes
[{ "amount": 10, "vendor": "john" }]
Enable or disable invoice generation for this payment link.
true
Response
Success response for creating a new payment link.
Payment link customer entity.
Show child attributes
Show child attributes
{
"customer_name": "John Doe",
"customer_phone": "9999999999",
"customer_email": "john@cashfree.com",
"customer_bank_account_number": 11111111111,
"customer_bank_ifsc": "SBIN0001882",
"customer_bank_code": 7001
}
Payment link meta information object.
Show child attributes
Show child attributes
{
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
"upi_intent": "false",
"return_url": "https://www.cashfree.com/devstudio/thankyou"
}
Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs.
Show child attributes
Show child attributes
{ "key_1": "value_1", "key_2": "value_2" }
Payment link Notify Object for SMS and Email.
Show child attributes
Show child attributes
{ "send_sms": false, "send_email": true }
Base64 encoded string for payment link. You can scan with camera to open a link in the browser to complete the payment.
Show child attributes
Show child attributes
Was this page helpful?