This API is used to share a payment link with a list of email IDs and/or phone numbers.
Environment
| Test Environment | https://uatoneapi.payu.in/payment-links/ |
| Production Environment | https://oneapi.payu.in/payment-links/ |
Note: The access token with the scope as read_payment_links is required on the header. For more information on getting the access token, refer to Get Access Token.
Important: The
channelListmust be passed as a query parameter in the request URL, not in the request body. Separate multiple email IDs and phone numbers with a comma (,) and URL-encode the value (for example,@becomes%40and,becomes%2C). This request does not require a request body.
Sample Requests
Basic Sample request
curl --location --request POST '<redacted URL>' \
--header 'merchantId: 8235900' \
--header 'Authorization: Bearer <access_token>'import requests
url = "<redacted URL>"
headers = {
"merchantId": "8235900",
"Authorization": "Bearer <access_token>"
}
# requests URL-encodes the query parameter value automatically
params = {
"channelList": "[email protected],9876543210"
}
response = requests.post(url, headers=headers, params=params)
print(response.json())<?php
$baseUrl = "<redacted URL>";
// http_build_query URL-encodes the query parameter value
$query = http_build_query([
"channelList" => "[email protected],9876543210"
]);
$url = $baseUrl . "?" . $query;
$headers = [
"merchantId: 8235900",
"Authorization: Bearer <access_token>"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>const fetch = require('node-fetch');
const baseUrl = '<redacted URL>';
// URLSearchParams URL-encodes the query parameter value
const query = new URLSearchParams({
channelList: '[email protected],9876543210'
});
const url = `${baseUrl}?${query.toString()}`;
const headers = {
'merchantId': '8235900',
'Authorization': 'Bearer <access_token>'
};
fetch(url, {
method: 'POST',
headers: headers
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class SharePaymentLink {
public static void main(String[] args) throws Exception {
String baseUrl = "<redacted URL>";
String channelList = URLEncoder.encode("[email protected],9876543210", StandardCharsets.UTF_8.toString());
URL url = new URL(baseUrl + "?channelList=" + channelList);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("merchantId", "8235900");
conn.setRequestProperty("Authorization", "Bearer <access_token>");
conn.setDoOutput(true);
conn.setFixedLengthStreamingMode(0); // No request body
try (BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream(), "utf-8"))) {
StringBuilder response = new StringBuilder();
String responseLine;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
}
}Sample response
Success scenario
{
"status": 0,
"message": null,
"result": {
"90447XXX": -1,
"[email protected]": 1
},
"errorCode": null,
"guid": "a956b03a-f663-401e-bade-177694yf94b9"
}Failure scenario
{
"status": 0,
"message": "string",
"result": {},
"errorCode": 170,
"guid": "f529e375-739f-4c8a-b5f5-0e67fa3f533f"
}Additional Request Parameters Info
Request headers
| Parameter | Description |
|---|---|
merchantId |
|
Authorization |
Bearer |
Path parameters
| Parameters | Description | Example |
|---|---|---|
id |
|
INV7444229847726 |
Reference info for query parameters
| Parameter | Description | Example |
|---|---|---|
| channelList mandatory | String This parameter must contain the email IDs and/or phone numbers to which the payment link needs to be shared. Pass it as a query parameter in the URL, separate multiple values with a comma (,), and URL-encode the value. | abc.example%40payu.in%2C9876543210 |
200