Live API console — authenticate, test, and explore the PayRails PayIn API in real time.
| Environment | Live Demo |
| Base URL | https://api.payrails.in/api/v1 |
| Authentication | x-api-key |
| Payment Method | UPI (Unified Payments Interface) |
| Currency | INR (hardcoded by platform) |
x-api-key header. No OAuth, no login session required.| Base URL | https://api.payrails.in/api/v1 |
| Auth method | x-api-key request header |
| Content type | application/json |
| Protocol | HTTPS only |
Content-Type: application/json Accept: application/json x-api-key: YOUR_API_KEY
Everything you need to accept your first UPI payment in under 5 minutes.
x-api-key from PayRails. Include it on every request.POST /transactionsupi_intent_url from response. Redirect the customer.Follow this sequence for every PayIn transaction.
Initiates a UPI payment session. Returns a upi_intent_url that the merchant redirects the customer to.
| Field | Required | Type | Notes |
|---|---|---|---|
| merchantTxnId | Required | string | Your unique transaction reference. Must be unique per merchant. |
| amount | Required | number | Transaction amount in INR. Positive number. |
| paymentMethod | Required | string | Must be UPI for the merchant API. |
| customer.name | Required | string | Customer's name for logging and provider handoff. |
| customer.email | Required | string | Customer's email address. |
| customer.mobile | Required | string | Customer's mobile number. |
| s2s_client_ip | Recommended | string | Customer's actual IP address. Used for fraud detection. Falls back to request IP if omitted. |
| s2s_device_info | Recommended | string | Customer's browser User-Agent. Falls back to request header if omitted. |
provider_id, provider_code, upi_vpa, routing_rule_id, routing_strategy โ these fields are rejected with HTTP 400.
callbackUrl / callback_url โ configure your webhook URL in the PayRails merchant settings instead.
The live form below creates a real transaction using this exact endpoint.
Enter an amount below and click Create UPI Transaction to execute a real API call. All debug panels below will populate with live data.
The upi_intent_url field in the response is a deep link that opens the customer's UPI app directly. It follows the standard upi://pay?... URI scheme.
upi://pay?pa=...&pn=...&am=...&tr=...&tn=...
| Platform | Recommended Approach |
|---|---|
| Android | Use <a href="upi://pay?..."> or trigger via JavaScript. Opens UPI app selector automatically. |
| iOS | Same deep link works on iOS. Not all UPI apps support iOS — GPay and PhonePe have iOS apps. |
| Desktop | Generate and display a QR code from the intent URL. Customer scans with phone. |
| Mobile web | Redirect directly. Device opens UPI app selector. |
A PayIn transaction transitions through these states after creation.
PayRails sends a webhook to your configured callback URL when a transaction reaches a terminal state (SUCCESS, FAILED, CANCELLED/EXPIRED). Configure your callback URL in the PayRails merchant settings.
{
"transaction_id": "internal-uuid",
"merchant_txn_id": "YOUR-REF-001",
"status": "SUCCESS",
"amount": "100",
"currency": "INR",
"provider": "razorpay",
"provider_txn_id": "pay_xxxxx",
"bank_reference": "HDFC123456",
"failure_code": null,
"failure_reason": null,
"completed_at": "2026-07-08T..."
}
| Field | Type | Description |
|---|---|---|
| transaction_id | string | PayRails internal UUID. Same as returned by Create Transaction. |
| merchant_txn_id | string | Your original reference from the Create Transaction request. |
| status | string | SUCCESS ยท FAILED ยท CANCELLED |
| amount | string | Transaction amount as stored (may be string). |
| currency | string | Always INR. |
| provider | string | Payment provider that processed the transaction. |
| provider_txn_id | string|null | Provider's own transaction reference. Null if payment never reached the provider. |
| bank_reference | string|null | Bank reference number (UTR). Available on SUCCESS for reconciliation. |
| failure_code | string|null | Provider-specific failure code. Null on SUCCESS. |
| failure_reason | string|null | Human-readable failure description. Null on SUCCESS. |
| completed_at | string | ISO-8601 UTC timestamp of webhook dispatch. |
transaction_id to prevent double-fulfilment on retries.
All errors from the PayIn backend. Every entry is verified from the actual implementation.
| HTTP | Error / Condition | Cause | Resolution |
|---|---|---|---|
| 400 | merchantTxnId is required | merchantTxnId missing from body. | Always include a unique merchantTxnId. |
| 400 | amount is required | amount missing or zero. | Send a positive numeric amount. |
| 400 | paymentMethod is required | paymentMethod field absent. | Send "paymentMethod": "UPI". |
| 400 | provider_id/provider_code not allowed | Merchant sent provider routing hints. | Remove provider_id / provider_code from body. |
| 400 | upi_vpa is not allowed | Merchant sent a VPA in the request. | Remove upi_vpa field. |
| 400 | routing hints not allowed | routing_rule_id or routing_strategy present. | Remove routing hint fields. |
| 401 | Unauthorized | Missing or invalid x-api-key header. | Include a valid API key. |
| 409 | Duplicate merchantTxnId | A transaction with this merchantTxnId already exists for your merchant. | Use a new unique reference. |
| 503 | No provider available | No payment provider is currently eligible for routing. | Retry with backoff. Contact support if persistent. |
Copy-paste ready. Replace YOUR_API_KEY with your actual key.
curl -X POST \
'https://api.payrails.in/api/v1/transactions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: YOUR_API_KEY' \
-d '{
"merchantTxnId": "ORDER-20260708121213",
"amount": 100,
"paymentMethod": "UPI",
"customer": {
"name": "Customer Name",
"email": "customer@example.com",
"mobile": "9876543210"
},
"s2s_client_ip": "1.2.3.4",
"s2s_device_info": "Mozilla/5.0 ..."
}'
Verify each item before going live with PayRails PayIn API.
x-api-key securely on the server. Never expose it in frontend JavaScript or mobile apps.merchantTxnId for every transaction (e.g. your internal order ID).transaction_id returned by the Create Transaction response immediately.upi_intent_url — do not attempt to parse or modify it.upi_intent_url rather than showing the raw URL.transaction_id to prevent double-fulfilment.FAILED correctly: log failure_reason and prompt the customer to retry.PENDING state: show a waiting indicator. Do not fulfil the order yet.CANCELLED: the payment window expired. Allow the customer to initiate a new transaction.bank_reference from the SUCCESS webhook for payment reconciliation.