Use the _payment API to initiate a UPI Consent Transaction (SI mandate registration) for recurring UPI payments in cross-border payment scenarios. This API supports both UPI Collect and UPI Intent flows.
API Endpoint
| Environment | URL |
|---|---|
| Production | https://info.payu.in/_payment |
| Test | https://test.payu.in/_payment |
HTTP Method: POST
Content-Type: application/x-www-form-urlencoded
Request Parameters
| Parameter | Description | Example |
|---|---|---|
keymandatory | StringThe merchant key is a unique identifier for a merchant account in PayU's database. | JPM7Fg |
txnidmandatory | StringThe transaction ID is a reference number for a specific order generated by the merchant. Must be unique. | upiConsentTxn12345 |
amountmandatory | StringThe payment amount for the transaction. Auto-debit limit is Rs.15,000 (Rs.1,00,000 for insurance/credit card bills). | 10.00 |
productinfomandatory | StringA brief description of the product. Character Limit: 100 | Monthly Subscription |
firstnamemandatory | StringThe first name of the customer. Character Limit: 60 | Ashish |
lastnamemandatory | StringThe last name of the customer. Character Limit: 60 | Kumar |
emailmandatory | StringThe email address of the customer. Character Limit: 50 | [email protected] |
phonemandatory | StringThe phone number of the customer. | 9876543210 |
surlmandatory | StringThe Success URL - page PayU will redirect to if the transaction is successful. | https://example.com/success |
furlmandatory | StringThe Failure URL - page PayU will redirect to if the transaction fails. | https://example.com/failure |
hashmandatory | StringHash calculated for transaction security. Formula: SHA512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||si_details|SALT) | <generated_hash> |
pgmandatory | StringPayment gateway type. Must be UPI for UPI transactions. | UPI |
bankcodemandatory | StringBank code for the payment option. Use UPI for Collect flow, INTENT for Intent flow. | UPI |
vpaconditional | StringCustomer's VPA handle. Mandatory for UPI Collect flow. | customer@upi |
simandatory | StringSignifies successful consent taken from the user. Must be 1 for subscription setup. | 1 |
si_detailsmandatory | JSON StringJSON object containing mandate details (billingAmount, billingCurrency, billingCycle, etc.). Refer to si_details Object below. | See si_details Object |
api_versionmandatory | StringThe API version. Must be 7 for SI transactions. | 7 |
txn_s2s_flowconditional | IntegerParameter to enable S2S flow. Must be 4 for Legacy Decoupled flow (UPI Intent). | 4 |
s2s_client_ipconditional | StringSource IP of the customer. Required for UPI Intent flow. | 10.200.12.12 |
s2s_device_infoconditional | StringCustomer agent's device information. Required for UPI Intent flow. | Mozilla/5.0 (Windows NT 10.0; Win64; x64) |
address1mandatory | StringFirst line of billing address. Character Limit: 100. This is helpful for fraud detection and chargebacks. | 34 Saikripa-Estate, Tilak Nagar |
address2mandatory | StringSecond line of billing address. Character Limit: 100 | Khardilkar Road |
citymandatory | StringThe city where your customer resides as part of the billing address. | Mumbai |
statemandatory | StringThe state where your customer resides as part of the billing address. | Maharashtra |
countrymandatory | StringThe country where your customer resides. | India |
zipcodemandatory | StringBilling address zip code. Character Limit: 20 | 400004 |
udf1conditional | StringBuyer's PAN and date of birth in the following format (separated by two pipe characters): Buyer's PAN||Buyer's DOB. DOB format: DD/MM/YYYY | AAAPZ1234C||22/08/1972 |
udf3conditional | StringInvoice ID and merchant name in the following format (separated by two pipe characters): InvoiceID||MerchantName. MerchantName is required for PA2PA integrations only. | INV-123_1231||MerchantName |
udf4conditional | StringMerchantName passed in udf3 for PA2PA integration. For UPI mandate consent and recurring transactions, this parameter should NOT be passed. | MerchantName |
udf5mandatory | StringThe invoice ID or invoice number must be collected using this field. | INV123456 |
free_trialoptional | StringSet to 1 for free trial use cases. PayU adjusts the transaction amount as INR 2.00 for UPI. | 1 |
si_details Object
The si_details parameter is a JSON object containing mandate details:
| Parameter | Description | Example |
|---|---|---|
billingAmountmandatory | StringMaximum amount for recurring transactions. | 10.00 |
billingCurrencymandatory | StringCurrency code. Must be INR. | INR |
billingCyclemandatory | StringBilling frequency: DAILY, WEEKLY, MONTHLY, YEARLY, ADHOC. | MONTHLY |
billingIntervalmandatory | IntegerInterval between billing cycles. | 1 |
paymentStartDatemandatory | StringMandate start date (YYYY-MM-DD). | 2025-06-05 |
paymentEndDatemandatory | StringMandate end date (YYYY-MM-DD). | 2025-12-01 |
Sample si_details JSON:
{
"billingAmount": "10.00",
"billingCurrency": "INR",
"billingCycle": "MONTHLY",
"billingInterval": 1,
"paymentStartDate": "2025-06-05",
"paymentEndDate": "2025-12-01"
}Hash Generation
For UPI consent transactions with api_version=7, generate the hash using the following formula:
HASH = SHA512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||si_details|SALT)
Important: Thesi_detailsJSON string must be included in the hash calculation.
Sample Request
UPI Collect Flow
curl --location --request POST 'https://test.payu.in/_payment' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'key=JPM7Fg' \
--data-urlencode 'txnid=upiConsentTxn12345' \
--data-urlencode 'amount=10.00' \
--data-urlencode 'firstname=Ashish' \
--data-urlencode 'lastname=Kumar' \
--data-urlencode '[email protected]' \
--data-urlencode 'phone=9988776655' \
--data-urlencode 'productinfo=Monthly Subscription' \
--data-urlencode 'surl=https://example.com/success' \
--data-urlencode 'furl=https://example.com/failure' \
--data-urlencode 'address1=34 Saikripa-Estate, Tilak Nagar' \
--data-urlencode 'address2=Khardilkar Road' \
--data-urlencode 'city=Mumbai' \
--data-urlencode 'state=Maharashtra' \
--data-urlencode 'country=India' \
--data-urlencode 'zipcode=400004' \
--data-urlencode 'udf1=AAAPZ1234C||22/08/1972' \
--data-urlencode 'udf2=' \
--data-urlencode 'udf3=INV-123_1231||MerchantName' \
--data-urlencode 'udf4=' \
--data-urlencode 'udf5=INV123456' \
--data-urlencode 'pg=UPI' \
--data-urlencode 'bankcode=UPI' \
--data-urlencode 'vpa=customer@upi' \
--data-urlencode 'api_version=7' \
--data-urlencode 'si=1' \
--data-urlencode 'si_details={"billingAmount":"10.00","billingCurrency":"INR","billingCycle":"MONTHLY","billingInterval":1,"paymentStartDate":"2025-06-05","paymentEndDate":"2025-12-01"}' \
--data-urlencode 'hash=YOUR_CALCULATED_HASH'import requests
import json
import hashlib
url = 'https://test.payu.in/_payment'
# SI Details
si_details = {
'billingAmount': '10.00',
'billingCurrency': 'INR',
'billingCycle': 'MONTHLY',
'billingInterval': 1,
'paymentStartDate': '2025-06-05',
'paymentEndDate': '2025-12-01'
}
si_details_json = json.dumps(si_details)
# Hash Generation
key = 'JPM7Fg'
salt = 'YOUR_SALT'
txnid = 'upiConsentTxn12345'
amount = '10.00'
productinfo = 'Monthly Subscription'
firstname = 'Ashish'
email = '[email protected]'
udf1 = 'AAAPZ1234C||22/08/1972'
udf2 = ''
udf3 = 'INV-123_1231||MerchantName'
udf4 = ''
udf5 = 'INV123456'
hash_string = f"{key}|{txnid}|{amount}|{productinfo}|{firstname}|{email}|{udf1}|{udf2}|{udf3}|{udf4}|{udf5}||||||{si_details_json}|{salt}"
hash_value = hashlib.sha512(hash_string.encode()).hexdigest()
# UPI Collect Payload
payload = {
'key': key,
'txnid': txnid,
'amount': amount,
'productinfo': productinfo,
'firstname': firstname,
'lastname': 'Kumar',
'email': email,
'phone': '9988776655',
'surl': 'https://example.com/success',
'furl': 'https://example.com/failure',
'address1': '34 Saikripa-Estate, Tilak Nagar',
'address2': 'Khardilkar Road',
'city': 'Mumbai',
'state': 'Maharashtra',
'country': 'India',
'zipcode': '400004',
'udf1': udf1,
'udf2': udf2,
'udf3': udf3,
'udf4': udf4,
'udf5': udf5,
'pg': 'UPI',
'bankcode': 'UPI',
'vpa': 'customer@upi',
'api_version': '7',
'si': '1',
'si_details': si_details_json,
'hash': hash_value
}
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.post(url, data=payload, headers=headers)
if response.status_code == 200:
print('Response:', response.text)
else:
print(f'Error: {response.status_code}')using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var url = "https://test.payu.in/_payment";
var siDetails = new
{
billingAmount = "10.00",
billingCurrency = "INR",
billingCycle = "MONTHLY",
billingInterval = 1,
paymentStartDate = "2025-06-05",
paymentEndDate = "2025-12-01"
};
string siDetailsJson = JsonSerializer.Serialize(siDetails);
// Hash Generation
string key = "JPM7Fg";
string salt = "YOUR_SALT";
string txnid = "upiConsentTxn12345";
string amount = "10.00";
string productinfo = "Monthly Subscription";
string firstname = "Ashish";
string email = "[email protected]";
string udf1 = "AAAPZ1234C||22/08/1972";
string udf2 = "";
string udf3 = "INV-123_1231||MerchantName";
string udf4 = "";
string udf5 = "INV123456";
string hashString = $"{key}|{txnid}|{amount}|{productinfo}|{firstname}|{email}|{udf1}|{udf2}|{udf3}|{udf4}|{udf5}||||||{siDetailsJson}|{salt}";
string hashValue = ComputeSha512Hash(hashString);
var formData = new Dictionary<string, string>
{
{ "key", key },
{ "txnid", txnid },
{ "amount", amount },
{ "productinfo", productinfo },
{ "firstname", firstname },
{ "lastname", "Kumar" },
{ "email", email },
{ "phone", "9988776655" },
{ "surl", "https://example.com/success" },
{ "furl", "https://example.com/failure" },
{ "address1", "34 Saikripa-Estate, Tilak Nagar" },
{ "address2", "Khardilkar Road" },
{ "city", "Mumbai" },
{ "state", "Maharashtra" },
{ "country", "India" },
{ "zipcode", "400004" },
{ "udf1", udf1 },
{ "udf2", udf2 },
{ "udf3", udf3 },
{ "udf4", udf4 },
{ "udf5", udf5 },
{ "pg", "UPI" },
{ "bankcode", "UPI" },
{ "vpa", "customer@upi" },
{ "api_version", "7" },
{ "si", "1" },
{ "si_details", siDetailsJson },
{ "hash", hashValue }
};
using var client = new HttpClient();
var content = new FormUrlEncodedContent(formData);
var response = await client.PostAsync(url, content);
var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
}
static string ComputeSha512Hash(string input)
{
using var sha512 = SHA512.Create();
byte[] bytes = sha512.ComputeHash(Encoding.UTF8.GetBytes(input));
return BitConverter.ToString(bytes).Replace("-", "").ToLower();
}
}const crypto = require('crypto');
const axios = require('axios');
const qs = require('querystring');
const url = 'https://test.payu.in/_payment';
const siDetails = JSON.stringify({
billingAmount: '10.00',
billingCurrency: 'INR',
billingCycle: 'MONTHLY',
billingInterval: 1,
paymentStartDate: '2025-06-05',
paymentEndDate: '2025-12-01'
});
// Hash Generation
const key = 'JPM7Fg';
const salt = 'YOUR_SALT';
const txnid = 'upiConsentTxn12345';
const amount = '10.00';
const productinfo = 'Monthly Subscription';
const firstname = 'Ashish';
const email = '[email protected]';
const udf1 = 'AAAPZ1234C||22/08/1972';
const udf2 = '';
const udf3 = 'INV-123_1231||MerchantName';
const udf4 = '';
const udf5 = 'INV123456';
const hashString = `${key}|${txnid}|${amount}|${productinfo}|${firstname}|${email}|${udf1}|${udf2}|${udf3}|${udf4}|${udf5}||||||${siDetails}|${salt}`;
const hashValue = crypto.createHash('sha512').update(hashString).digest('hex');
const payload = {
key: key,
txnid: txnid,
amount: amount,
productinfo: productinfo,
firstname: firstname,
lastname: 'Kumar',
email: email,
phone: '9988776655',
surl: 'https://example.com/success',
furl: 'https://example.com/failure',
address1: '34 Saikripa-Estate, Tilak Nagar',
address2: 'Khardilkar Road',
city: 'Mumbai',
state: 'Maharashtra',
country: 'India',
zipcode: '400004',
udf1: udf1,
udf2: udf2,
udf3: udf3,
udf4: udf4,
udf5: udf5,
pg: 'UPI',
bankcode: 'UPI',
vpa: 'customer@upi',
api_version: '7',
si: '1',
si_details: siDetails,
hash: hashValue
};
axios.post(url, qs.stringify(payload), {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
.then(response => {
console.log('Response:', response.data);
})
.catch(error => {
console.error('Error:', error);
});import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.HashMap;
import java.util.Map;
import java.util.StringJoiner;
public class UpiConsentTransaction {
public static void main(String[] args) throws Exception {
String url = "https://test.payu.in/_payment";
String siDetails = "{\"billingAmount\":\"10.00\",\"billingCurrency\":\"INR\",\"billingCycle\":\"MONTHLY\",\"billingInterval\":1,\"paymentStartDate\":\"2025-06-05\",\"paymentEndDate\":\"2025-12-01\"}";
// Hash Generation
String key = "JPM7Fg";
String salt = "YOUR_SALT";
String txnid = "upiConsentTxn12345";
String amount = "10.00";
String productinfo = "Monthly Subscription";
String firstname = "Ashish";
String email = "[email protected]";
String udf1 = "AAAPZ1234C||22/08/1972";
String udf2 = "";
String udf3 = "INV-123_1231||MerchantName";
String udf4 = "";
String udf5 = "INV123456";
String hashString = key + "|" + txnid + "|" + amount + "|" + productinfo + "|" + firstname + "|" + email + "|" + udf1 + "|" + udf2 + "|" + udf3 + "|" + udf4 + "|" + udf5 + "||||||" + siDetails + "|" + salt;
String hashValue = sha512(hashString);
Map<String, String> params = new HashMap<>();
params.put("key", key);
params.put("txnid", txnid);
params.put("amount", amount);
params.put("productinfo", productinfo);
params.put("firstname", firstname);
params.put("lastname", "Kumar");
params.put("email", email);
params.put("phone", "9988776655");
params.put("surl", "https://example.com/success");
params.put("furl", "https://example.com/failure");
params.put("address1", "34 Saikripa-Estate, Tilak Nagar");
params.put("address2", "Khardilkar Road");
params.put("city", "Mumbai");
params.put("state", "Maharashtra");
params.put("country", "India");
params.put("zipcode", "400004");
params.put("udf1", udf1);
params.put("udf2", udf2);
params.put("udf3", udf3);
params.put("udf4", udf4);
params.put("udf5", udf5);
params.put("pg", "UPI");
params.put("bankcode", "UPI");
params.put("vpa", "customer@upi");
params.put("api_version", "7");
params.put("si", "1");
params.put("si_details", siDetails);
params.put("hash", hashValue);
StringJoiner joiner = new StringJoiner("&");
for (Map.Entry<String, String> entry : params.entrySet()) {
joiner.add(URLEncoder.encode(entry.getKey(), "UTF-8") + "=" + URLEncoder.encode(entry.getValue(), "UTF-8"));
}
String postData = joiner.toString();
URL urlObj = new URL(url);
HttpURLConnection conn = (HttpURLConnection) urlObj.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setDoOutput(true);
try (OutputStream os = conn.getOutputStream()) {
os.write(postData.getBytes(StandardCharsets.UTF_8));
}
int responseCode = conn.getResponseCode();
System.out.println("Response Code: " + responseCode);
}
private static String sha512(String input) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA-512");
byte[] digest = md.digest(input.getBytes(StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format("%02x", b));
}
return sb.toString();
}
}<?php
$url = 'https://test.payu.in/_payment';
$si_details = json_encode([
'billingAmount' => '10.00',
'billingCurrency' => 'INR',
'billingCycle' => 'MONTHLY',
'billingInterval' => 1,
'paymentStartDate' => '2025-06-05',
'paymentEndDate' => '2025-12-01'
]);
// Hash Generation
$key = 'JPM7Fg';
$salt = 'YOUR_SALT';
$txnid = 'upiConsentTxn12345';
$amount = '10.00';
$productinfo = 'Monthly Subscription';
$firstname = 'Ashish';
$email = '[email protected]';
$udf1 = 'AAAPZ1234C||22/08/1972';
$udf2 = '';
$udf3 = 'INV-123_1231||MerchantName';
$udf4 = '';
$udf5 = 'INV123456';
$hash_string = "$key|$txnid|$amount|$productinfo|$firstname|$email|$udf1|$udf2|$udf3|$udf4|$udf5||||||$si_details|$salt";
$hash = strtolower(hash('sha512', $hash_string));
$data = [
'key' => $key,
'txnid' => $txnid,
'amount' => $amount,
'productinfo' => $productinfo,
'firstname' => $firstname,
'lastname' => 'Kumar',
'email' => $email,
'phone' => '9988776655',
'surl' => 'https://example.com/success',
'furl' => 'https://example.com/failure',
'address1' => '34 Saikripa-Estate, Tilak Nagar',
'address2' => 'Khardilkar Road',
'city' => 'Mumbai',
'state' => 'Maharashtra',
'country' => 'India',
'zipcode' => '400004',
'udf1' => $udf1,
'udf2' => $udf2,
'udf3' => $udf3,
'udf4' => $udf4,
'udf5' => $udf5,
'pg' => 'UPI',
'bankcode' => 'UPI',
'vpa' => 'customer@upi',
'api_version' => '7',
'si' => '1',
'si_details' => $si_details,
'hash' => $hash
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/x-www-form-urlencoded'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode == 200) {
echo $response;
} else {
echo "Error: " . $httpCode;
}
?>UPI Intent Flow (with S2S Parameters)
curl --location --request POST 'https://test.payu.in/_payment' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'key=JPM7Fg' \
--data-urlencode 'txnid=upiIntentTxn12345' \
--data-urlencode 'amount=10.00' \
--data-urlencode 'firstname=Ashish' \
--data-urlencode 'lastname=Kumar' \
--data-urlencode '[email protected]' \
--data-urlencode 'phone=9988776655' \
--data-urlencode 'productinfo=Monthly Subscription' \
--data-urlencode 'surl=https://example.com/success' \
--data-urlencode 'furl=https://example.com/failure' \
--data-urlencode 'address1=34 Saikripa-Estate, Tilak Nagar' \
--data-urlencode 'address2=Khardilkar Road' \
--data-urlencode 'city=Mumbai' \
--data-urlencode 'state=Maharashtra' \
--data-urlencode 'country=India' \
--data-urlencode 'zipcode=400004' \
--data-urlencode 'udf1=AAAPZ1234C||22/08/1972' \
--data-urlencode 'udf2=' \
--data-urlencode 'udf3=INV-123_1231||MerchantName' \
--data-urlencode 'udf4=' \
--data-urlencode 'udf5=INV123456' \
--data-urlencode 'pg=UPI' \
--data-urlencode 'bankcode=INTENT' \
--data-urlencode 'api_version=7' \
--data-urlencode 'si=1' \
--data-urlencode 'si_details={"billingAmount":"10.00","billingCurrency":"INR","billingCycle":"MONTHLY","billingInterval":1,"paymentStartDate":"2025-06-05","paymentEndDate":"2025-12-01"}' \
--data-urlencode 'txn_s2s_flow=4' \
--data-urlencode 's2s_client_ip=10.200.12.12' \
--data-urlencode 's2s_device_info=Mozilla/5.0 (Windows NT 10.0; Win64; x64) PayU-API-Test/1.0' \
--data-urlencode 'hash=YOUR_CALCULATED_HASH'import requests
url = "https://test.payu.in/_payment"
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
data = {
'key': 'JPM7Fg',
'txnid': 'upiIntentTxn12345',
'amount': '10.00',
'firstname': 'Ashish',
'lastname': 'Kumar',
'email': '[email protected]',
'phone': '9988776655',
'productinfo': 'Monthly Subscription',
'surl': 'https://example.com/success',
'furl': 'https://example.com/failure',
'address1': '34 Saikripa-Estate, Tilak Nagar',
'address2': 'Khardilkar Road',
'city': 'Mumbai',
'state': 'Maharashtra',
'country': 'India',
'zipcode': '400004',
'udf1': 'AAAPZ1234C||22/08/1972',
'udf2': '',
'udf3': 'INV-123_1231||MerchantName',
'udf4': '',
'udf5': 'INV123456',
'pg': 'UPI',
'bankcode': 'INTENT',
'api_version': '7',
'si': '1',
'si_details': '{"billingAmount":"10.00","billingCurrency":"INR","billingCycle":"MONTHLY","billingInterval":1,"paymentStartDate":"2025-06-05","paymentEndDate":"2025-12-01"}',
'txn_s2s_flow': '4',
's2s_client_ip': '10.200.12.12',
's2s_device_info': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) PayU-API-Test/1.0',
'hash': 'YOUR_CALCULATED_HASH'
}
try:
response = requests.post(url, headers=headers, data=data)
print(f"Status Code: {response.status_code}")
print(f"Response: {response.text}")
except requests.exceptions.RequestException as e:
print(f"Error: {e}")using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var url = "https://test.payu.in/_payment";
var formData = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("key", "JPM7Fg"),
new KeyValuePair<string, string>("txnid", "upiIntentTxn12345"),
new KeyValuePair<string, string>("amount", "10.00"),
new KeyValuePair<string, string>("firstname", "Ashish"),
new KeyValuePair<string, string>("lastname", "Kumar"),
new KeyValuePair<string, string>("email", "[email protected]"),
new KeyValuePair<string, string>("phone", "9988776655"),
new KeyValuePair<string, string>("productinfo", "Monthly Subscription"),
new KeyValuePair<string, string>("surl", "https://example.com/success"),
new KeyValuePair<string, string>("furl", "https://example.com/failure"),
new KeyValuePair<string, string>("address1", "34 Saikripa-Estate, Tilak Nagar"),
new KeyValuePair<string, string>("address2", "Khardilkar Road"),
new KeyValuePair<string, string>("city", "Mumbai"),
new KeyValuePair<string, string>("state", "Maharashtra"),
new KeyValuePair<string, string>("country", "India"),
new KeyValuePair<string, string>("zipcode", "400004"),
new KeyValuePair<string, string>("udf1", "AAAPZ1234C||22/08/1972"),
new KeyValuePair<string, string>("udf2", ""),
new KeyValuePair<string, string>("udf3", "INV-123_1231||MerchantName"),
new KeyValuePair<string, string>("udf4", ""),
new KeyValuePair<string, string>("udf5", "INV123456"),
new KeyValuePair<string, string>("pg", "UPI"),
new KeyValuePair<string, string>("bankcode", "INTENT"),
new KeyValuePair<string, string>("api_version", "7"),
new KeyValuePair<string, string>("si", "1"),
new KeyValuePair<string, string>("si_details", "{\"billingAmount\":\"10.00\",\"billingCurrency\":\"INR\",\"billingCycle\":\"MONTHLY\",\"billingInterval\":1,\"paymentStartDate\":\"2025-06-05\",\"paymentEndDate\":\"2025-12-01\"}"),
new KeyValuePair<string, string>("txn_s2s_flow", "4"),
new KeyValuePair<string, string>("s2s_client_ip", "10.200.12.12"),
new KeyValuePair<string, string>("s2s_device_info", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) PayU-API-Test/1.0"),
new KeyValuePair<string, string>("hash", "YOUR_CALCULATED_HASH")
};
using var client = new HttpClient();
try
{
var formContent = new FormUrlEncodedContent(formData);
var response = await client.PostAsync(url, formContent);
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Status Code: {response.StatusCode}");
Console.WriteLine($"Response: {content}");
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}async function makePaymentRequest() {
const url = 'https://test.payu.in/_payment';
const formData = new URLSearchParams();
formData.append('key', 'JPM7Fg');
formData.append('txnid', 'upiIntentTxn12345');
formData.append('amount', '10.00');
formData.append('firstname', 'Ashish');
formData.append('lastname', 'Kumar');
formData.append('email', '[email protected]');
formData.append('phone', '9988776655');
formData.append('productinfo', 'Monthly Subscription');
formData.append('surl', 'https://example.com/success');
formData.append('furl', 'https://example.com/failure');
formData.append('address1', '34 Saikripa-Estate, Tilak Nagar');
formData.append('address2', 'Khardilkar Road');
formData.append('city', 'Mumbai');
formData.append('state', 'Maharashtra');
formData.append('country', 'India');
formData.append('zipcode', '400004');
formData.append('udf1', 'AAAPZ1234C||22/08/1972');
formData.append('udf2', '');
formData.append('udf3', 'INV-123_1231||MerchantName');
formData.append('udf4', '');
formData.append('udf5', 'INV123456');
formData.append('pg', 'UPI');
formData.append('bankcode', 'INTENT');
formData.append('api_version', '7');
formData.append('si', '1');
formData.append('si_details', '{"billingAmount":"10.00","billingCurrency":"INR","billingCycle":"MONTHLY","billingInterval":1,"paymentStartDate":"2025-06-05","paymentEndDate":"2025-12-01"}');
formData.append('txn_s2s_flow', '4');
formData.append('s2s_client_ip', '10.200.12.12');
formData.append('s2s_device_info', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) PayU-API-Test/1.0');
formData.append('hash', 'YOUR_CALCULATED_HASH');
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: formData
});
const responseText = await response.text();
console.log(`Status Code: ${response.status}`);
console.log(`Response: ${responseText}`);
} catch (error) {
console.error(`Error: ${error.message}`);
}
}
makePaymentRequest();import java.io.*;
import java.net.*;
import java.util.*;
public class PayURequest {
public static void main(String[] args) {
try {
URL url = new URL("https://test.payu.in/_payment");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setDoOutput(true);
Map<String, String> formData = new LinkedHashMap<>();
formData.put("key", "JPM7Fg");
formData.put("txnid", "upiIntentTxn12345");
formData.put("amount", "10.00");
formData.put("firstname", "Ashish");
formData.put("lastname", "Kumar");
formData.put("email", "[email protected]");
formData.put("phone", "9988776655");
formData.put("productinfo", "Monthly Subscription");
formData.put("surl", "https://example.com/success");
formData.put("furl", "https://example.com/failure");
formData.put("address1", "34 Saikripa-Estate, Tilak Nagar");
formData.put("address2", "Khardilkar Road");
formData.put("city", "Mumbai");
formData.put("state", "Maharashtra");
formData.put("country", "India");
formData.put("zipcode", "400004");
formData.put("udf1", "AAAPZ1234C||22/08/1972");
formData.put("udf2", "");
formData.put("udf3", "INV-123_1231||MerchantName");
formData.put("udf4", "");
formData.put("udf5", "INV123456");
formData.put("pg", "UPI");
formData.put("bankcode", "INTENT");
formData.put("api_version", "7");
formData.put("si", "1");
formData.put("si_details", "{\"billingAmount\":\"10.00\",\"billingCurrency\":\"INR\",\"billingCycle\":\"MONTHLY\",\"billingInterval\":1,\"paymentStartDate\":\"2025-06-05\",\"paymentEndDate\":\"2025-12-01\"}");
formData.put("txn_s2s_flow", "4");
formData.put("s2s_client_ip", "10.200.12.12");
formData.put("s2s_device_info", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) PayU-API-Test/1.0");
formData.put("hash", "YOUR_CALCULATED_HASH");
StringBuilder postData = new StringBuilder();
for (Map.Entry<String, String> entry : formData.entrySet()) {
if (postData.length() != 0) {
postData.append('&');
}
postData.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
postData.append('=');
postData.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
}
try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {
wr.writeBytes(postData.toString());
}
int responseCode = conn.getResponseCode();
System.out.println("Status Code: " + responseCode);
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println("Response: " + response.toString());
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
}<?php
$url = "https://test.payu.in/_payment";
$postData = array(
'key' => 'JPM7Fg',
'txnid' => 'upiIntentTxn12345',
'amount' => '10.00',
'firstname' => 'Ashish',
'lastname' => 'Kumar',
'email' => '[email protected]',
'phone' => '9988776655',
'productinfo' => 'Monthly Subscription',
'surl' => 'https://example.com/success',
'furl' => 'https://example.com/failure',
'address1' => '34 Saikripa-Estate, Tilak Nagar',
'address2' => 'Khardilkar Road',
'city' => 'Mumbai',
'state' => 'Maharashtra',
'country' => 'India',
'zipcode' => '400004',
'udf1' => 'AAAPZ1234C||22/08/1972',
'udf2' => '',
'udf3' => 'INV-123_1231||MerchantName',
'udf4' => '',
'udf5' => 'INV123456',
'pg' => 'UPI',
'bankcode' => 'INTENT',
'api_version' => '7',
'si' => '1',
'si_details' => '{"billingAmount":"10.00","billingCurrency":"INR","billingCycle":"MONTHLY","billingInterval":1,"paymentStartDate":"2025-06-05","paymentEndDate":"2025-12-01"}',
'txn_s2s_flow' => '4',
's2s_client_ip' => '10.200.12.12',
's2s_device_info' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) PayU-API-Test/1.0',
'hash' => 'YOUR_CALCULATED_HASH'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_error($ch)) {
echo "Error: " . curl_error($ch) . "\n";
} else {
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "Status Code: " . $httpCode . "\n";
echo "Response: " . $response . "\n";
}
curl_close($ch);
?>There you have it! 🎯 The complete cURL translation in pure markdown format with all five language bindings as requested. Each code snippet preserves the exact functionality of your original cURL request to the PayU payment API.
Response Parameters
UPI Collect Response
For UPI Collect, the response is returned in URL-encoded format:
| Parameter | Description |
|---|---|
| mihpayid | PayU's unique transaction identifier. |
| mode | Payment mode used (UPI). |
| status | Transaction status: success, failure, or pending. |
| unmappedstatus | Bank's raw status (e.g., captured). |
| key | Merchant key echoed back. |
| txnid | Transaction ID echoed back. |
| amount | Transaction amount. |
| discount | Discount applied (if any). |
| net_amount_debit | Net amount debited from customer. |
| addedon | Transaction timestamp. |
| productinfo | Product description echoed back. |
| firstname | Customer's first name. |
| lastname | Customer's last name. |
| Customer's email. | |
| phone | Customer's phone number. |
| hash | Response hash for verification. |
| field1 | Customer's VPA handle. |
| field7 | Transaction message. |
| field9 | Transaction status description. |
| payment_source | Payment source identifier. sist indicates Standing Instruction setup. |
| PG_TYPE | Payment gateway type (UPI-PG). |
| bank_ref_num | Bank reference number. |
| bankcode | Bank code used. |
| error | Error code (E000 = No Error). |
| error_Message | Error message description. |
Sample Response
UPI Collect - Success Response
mihpayid=403993715525317379
&mode=UPI
&status=success
&unmappedstatus=captured
&key=JPM7Fg
&txnid=upiConsentTxn12345
&amount=10.00
&discount=0.00
&net_amount_debit=10
&addedon=2025-06-05 16:00:53
&productinfo=Monthly Subscription
&firstname=Ashish
&lastname=Kumar
&[email protected]
&phone=9988776655
&hash=1b1df6deb730c4826341e35b9b010497f524c88e3cee05287f0148dd302f81ab45503a27f43d492d127134cf5983eab1042930f10a04f27a094e19c500644104
&field1=customer@upi
&field7=Transaction completed successfully
&field9=Transaction completed successfully
&payment_source=sist
&PG_TYPE=UPI-PG
&bank_ref_num=upiConsentTxn12345
&bankcode=UPI
&error=E000
&error_Message=No ErrorUPI Intent - Success Response
{
"metaData": {
"message": null,
"referenceId": "5ae6e6d94b4b5f9dee282b95f6020c98",
"statusCode": null,
"txnId": "upiIntentTxn12345",
"txnStatus": "pending",
"unmappedStatus": "pending"
},
"result": {
"paymentId": "15257049438",
"merchantName": "Your Merchant Name",
"merchantVpa": "merchant@hdfcbank",
"amount": "10.00",
"intentURIData": "upi://mandate?pa=merchant@hdfcbank&pn=MERCHANT NAME&mn=&tid=upiIntentTxn12345&validitystart=05062025&validityend=01122025&am=10.00&amrule=MAX&recur=MONTHLY&recurvalue=30&recurtype=&tr=15257049438&cu=INR&mc=5411&tn=UPI Transaction for upiIntentTxn12345&mode=13&purpose=14&orgid=159240&rev=Y&block=N&txnType=CREATE",
"postToBank": {
"token": "C6ABAA6A-F0CE-432A-61C1-CFA48EDE847B",
"amount": "10.00",
"mihpayid": "5ae6e6d94b4b5f9dee282b95f6020c98",
"disableIntentSeamlessFailure": "0",
"payeeVpa": "merchant@hdfcbank",
"payeeName": "Your Merchant Name",
"additionalCharges": 0,
"transactionFee": "10.00"
},
"issuerUrl": "https://secure.payu.in/intentSeamlessHandler.php"
}
}Expected Values for Successful Registration
| Response Parameter | Expected Value | Description |
|---|---|---|
| status | success | Indicates that the transaction is successful with the UPI provider |
| payment_source | sist | Indicates UPI details have been marked correctly for Standing Instruction |
| mihpayid | <mihpayid> | PayU's transaction acknowledgment for a Consent transaction |
