Start a payment from an existing payment link.
Use this endpoint to start a payment from a payment link. merchant_id, txnid, pg, bankcode, and card fields are not on this request.
Method
POST
Endpoint
/partner/payment-link/payment
Environment
| Environment | URL |
|---|---|
| Test Environment | https://test-partnerapilayer.payu.in/apilayer/partner/payment-link/payment |
| Production Environment | https://api.payu.in/partner/payment-link/payment |
Sample Request
curl -X POST https://test-partnerapilayer.payu.in/apilayer/partner/payment-link/payment \
-H "Content-Type: application/json" \
-H "Authorization: Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123" \
-d '{
"payment_link_id": "https://u.payu.in/PAYUID",
"phone_number": "9999999999",
"redirect_url": "https://merchant.example.com/return"
}'import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class PartnerRequest {
public static void main(String[] args) throws Exception {
String body = "{\"payment_link_id\": \"https://u.payu.in/PAYUID\", \"phone_number\": \"9999999999\", \"redirect_url\": \"https://merchant.example.com/return\"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://test-partnerapilayer.payu.in/apilayer/partner/payment-link/payment"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}import requests
url = "https://test-partnerapilayer.payu.in/apilayer/partner/payment-link/payment"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"
}
payload = {
"payment_link_id": "https://u.payu.in/PAYUID",
"phone_number": "9999999999",
"redirect_url": "https://merchant.example.com/return"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://test-partnerapilayer.payu.in/apilayer/partner/payment-link/payment",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"payment_link_id\": \"https://u.payu.in/PAYUID\", \"phone_number\": \"9999999999\", \"redirect_url\": \"https://merchant.example.com/return\"}",
CURLOPT_HTTPHEADER => ["Content-Type: application/json", "Authorization: Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"],
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($curl);
curl_close($curl);const response = await fetch("https://test-partnerapilayer.payu.in/apilayer/partner/payment-link/payment", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"
},
body: JSON.stringify({
"payment_link_id": "https://u.payu.in/PAYUID",
"phone_number": "9999999999",
"redirect_url": "https://merchant.example.com/return"
})
});
console.log(await response.text());using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://test-partnerapilayer.payu.in/apilayer/partner/payment-link/payment");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123");
request.Content = new StringContent("{\"payment_link_id\": \"https://u.payu.in/PAYUID\", \"phone_number\": \"9999999999\", \"redirect_url\": \"https://merchant.example.com/return\"}", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());require "net/http"
require "json"
uri = URI("https://test-partnerapilayer.payu.in/apilayer/partner/payment-link/payment")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"
request.body = {"payment_link_id": "https://u.payu.in/PAYUID", "phone_number": "9999999999", "redirect_url": "https://merchant.example.com/return"}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
puts response.body
Mandatory ParametersParameters marked with * are mandatory.
| Parameter | Description |
|---|---|
Content-Type* | string Send the body as application/json. |
Authorization* | string Partner access token. Send as Authorization Bearer token. |
payment_link_id* | string Payment link id. |
phone_number* | string 5 to 16 digits, or empty. Empty is rejected by the required check. |
redirect_url | string Optional in the DTO. When present, the domain is validated. |
Sample Response
{
"order_ref_id": "ORDER1001",
"hpp_url": "https://secure.payu.in/_payment?mihpayid=403993715521855092",
"expiry_time": 1735689600
}| Parameter | Description |
|---|---|
order_ref_id | Transaction id from the payment link. |
hpp_url | Hosted checkout URL. A UPI payment link returns upi_intent_url instead of this field. |
expiry_time | Checkout expiry as a Unix epoch in seconds. |
Errors
Below are the failure scenarios.
Invalid Auth token
{
"error": "Invalid Auth token"
}Reason: This error occurs when the auth token is missing or invalid.
Recommended Fix: Generate a new auth token and send it in the Authorization header.
