PayNexus provides a simple REST API to integrate UPI payments into your website or app.
https://api.paynexus.in/v1All API requests require your API key in the request header.
X-API-Key: pn_live_your_api_key_here Content-Type: application/json
Initiate a new UPI payment session and get a QR code URL and deep link.
| Parameter | Type | Required | Description |
|---|---|---|---|
| amount | float | Required | Amount in INR (e.g., 999.00) |
| order_id | string | Required | Your unique order identifier |
| callback_url | string | Required | Webhook URL for payment events |
| redirect_url | string | Optional | Redirect after payment completion |
| customer_name | string | Optional | Customer's name |
| customer_email | string | Optional | Customer's email |
| description | string | Optional | Payment description / note |
$ch = curl_init("https://api.paynexus.in/v1/payment/create");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: pn_live_your_key",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
"amount" => 1499.00,
"order_id" => "ORD_" . time(),
"callback_url" => "https://yoursite.com/webhook",
"redirect_url" => "https://yoursite.com/success",
"description" => "Product Purchase"
])
]);
$response = json_decode(curl_exec($ch), true);
// $response["payment_url"] — redirect customer here
{
"status": "success",
"txn_ref": "TXN20250115ABC123",
"payment_url": "https://pay.paynexus.in/TXN20250115ABC123",
"qr_url": "https://api.paynexus.in/v1/qr/TXN20250115ABC123.png",
"upi_deep_link": "upi://pay?pa=merchant@upi&pn=Merchant&am=1499&tn=Order",
"expires_at": "2025-01-15T10:33:00Z"
}
Verify payment status by transaction reference.
{
"status": "success",
"txn_ref": "TXN20250115ABC123",
"amount": 1499.00,
"utr_number": "UTR123456789",
"payer_upi": "customer@paytm",
"payer_name": "Rahul Sharma",
"paid_at": "2025-01-15T10:27:45Z"
}
Generate a UPI QR code image for a specific amount.
| Parameter | Type | Required | Description |
|---|---|---|---|
| amount | float | Optional | Fixed amount (leave blank for dynamic) |
| note | string | Optional | Transaction note displayed to payer |
| size | integer | Optional | QR size in px (200–800, default 300) |
| HTTP Code | Error Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS | Missing or invalid request parameters |
| 401 | UNAUTHORIZED | Invalid or missing API key |
| 402 | PLAN_LIMIT | Monthly transaction limit exceeded |
| 404 | NOT_FOUND | Transaction or resource not found |
| 409 | DUPLICATE_ORDER | Order ID already exists |
| 422 | UPI_NOT_SET | Merchant UPI ID not configured |
| 500 | SERVER_ERROR | Internal server error |
PayNexus sends POST requests to your webhook URL when payment events occur.
| Event | Description |
|---|---|
| payment.success | Payment received and confirmed |
| payment.failed | Payment attempt failed |
| payment.pending | Payment initiated but not confirmed |
| payment.expired | Payment window expired (5 minutes) |
| link.paid | Payment link was successfully paid |