Take UPI payments with Terralead
Your server creates an order, your customer pays on a page we host or in your own screen, and a signed webhook tells your server when the money has arrived. You can also send payouts from your balance to bank accounts and UPI IDs.
- Base URL
- https://paymenthub.terra-lead.co
- Authentication
- Authorization: Bearer sk_test_…
- Format
- JSON in and out. Amounts in paise (₹499.00 is 49900).
Contents
- Getting started
- Create an order
- The order object
- Statuses
- Showing the payment
- Read an order
- Bank reference (P2P)
- Webhooks
- Errors
- Test mode
- Payouts
- Beneficiaries
- Send a payout
- USDT payouts
- The payout object
- Payout statuses
- Balance
- Payout webhooks
- Payout errors
- Test payouts
- Key + Salt payouts
- Signing requests
- Beneficiaries, payouts, status
- Payout callback
- Key + Salt errors
- Key + Salt pay-ins
- Create an order (Key + Salt)
- Order status (Key + Salt)
- Pay-in callback
- Key + Salt pay-in errors
Getting started
Your account manager makes your API keys and gives each one to you once: keep it on your server, never in an app or a web page. In your Terralead dashboard, the developer settings list your keys (you can revoke one there) and show your webhook signing secret. The same key works for orders and payouts.
sk_test_…keys make test orders. No money moves; you pay them with a button (see Test mode).sk_live_…keys make real orders. They work once live payments are switched on for your account.
Send the key with every request, and send requests to your base URL:
curl "https://paymenthub.terra-lead.co/v1/orders/INV-1042" \
-H "Authorization: Bearer $SECRET_KEY"A payment goes like this:
- Your server creates an order with your own reference and the amount.
- Your customer pays: send them to the order's
pay_url, or show its UPI link in your own page. - We send your server a signed webhook when the order is paid (or fails, or runs out of time). Mark your order paid only then.
For live keys you can list the server addresses allowed to use them. A request from any other address is refused with IP_NOT_ALLOWED.
Create an order
POST/v1/orders
curl -X POST "https://paymenthub.terra-lead.co/v1/orders" \
-H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"reference": "INV-1042",
"amount": 49900,
"description": "Order 1042",
"customer": { "name": "Asha Rao", "phone": "9876543210" },
"return_url": "https://shop.example/orders/1042",
"callback_url": "https://shop.example/webhooks/payments"
}'const res = await fetch("https://paymenthub.terra-lead.co/v1/orders", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
reference: "INV-1042",
amount: 49900, // paise: ₹499.00
description: "Order 1042",
customer: { name: "Asha Rao", phone: "9876543210" },
return_url: "https://shop.example/orders/1042",
callback_url: "https://shop.example/webhooks/payments",
}),
});
const order = await res.json();
if (!res.ok) throw new Error(`${order.code}: ${order.message}`);
// Send the customer to order.pay_url (or show order.upi_intent in your own page).<?php
$ch = curl_init("https://paymenthub.terra-lead.co/v1/orders");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SECRET_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"reference" => "INV-1042",
"amount" => 49900, // paise: ₹499.00
"description" => "Order 1042",
"customer" => ["name" => "Asha Rao", "phone" => "9876543210"],
"return_url" => "https://shop.example/orders/1042",
"callback_url" => "https://shop.example/webhooks/payments",
]),
]);
$order = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception($order["code"] . ": " . $order["message"]);
}
// Send the customer to the pay page.
header("Location: " . $order["pay_url"]);import os
import requests
res = requests.post(
"https://paymenthub.terra-lead.co/v1/orders",
headers={"Authorization": f"Bearer {os.environ['SECRET_KEY']}"},
json={
"reference": "INV-1042",
"amount": 49900, # paise: ₹499.00
"description": "Order 1042",
"customer": {"name": "Asha Rao", "phone": "9876543210"},
"return_url": "https://shop.example/orders/1042",
"callback_url": "https://shop.example/webhooks/payments",
},
timeout=30,
)
order = res.json()
if res.status_code >= 400:
raise RuntimeError(f"{order['code']}: {order['message']}")
# Send the customer to order["pay_url"]Request fields
- referencestring, required
- Your own id for this payment, 1–64 characters: letters, digits and _ . : - /. Unique per mode. Sending the same reference and amount again returns the same order, so a retry never charges twice.
- amountinteger, required
- In paise: ₹499.00 is 49900. Whole numbers only.
- currencystring
- "INR", the only currency. May be left out.
- flowstring
- "INTENT" (a payment the processor confirms) or "P2P" (the customer pays a UPI ID by QR). Left out: your account's default.
- descriptionstring
- Up to 100 characters, for your own records.
- customerobject
- Who is paying. Every field is optional; see below.
- return_urlstring
- Where the pay page sends the customer when the payment ends. order_id, reference and status are added to it. Left out: your account's return URL, if set.
- callback_urlstring
- Where this order's webhooks go. Left out: your account's pay-in webhook URL.
- expires_ininteger
- Seconds the customer has to pay, 120–86400. It can shorten your account's window, never lengthen it.
- metadataobject
- Up to 20 keys of your own (names up to 40 characters; values are strings up to 200 characters, numbers or true / false), returned on the order and in webhooks.
customer
- customer.namestring
- Up to 80 characters.
- customer.emailstring
- An email address.
- customer.phonestring
- 10–13 digits, optionally with a leading +.
- customer.vpastring
- The customer's UPI ID, when you know it.
- customer.ipstring
- The customer's IP address (not your server's).
The answer
201 with the new order. Sending the same reference and amount again answers 200 with the same order, so a request that timed out can safely be sent again. The same reference with another amount is refused with REFERENCE_REUSED. Test and live orders are kept apart: a reference used in test mode is free in live mode.
{
"id": "ord_8m2k4q7x9c1v3b5n6z0w2e4r",
"reference": "INV-1042",
"status": "PENDING",
"amount": 49900,
"amount_paid": null,
"currency": "INR",
"flow": "INTENT",
"mode": "live",
"checkout": "H2H",
"pay_url": "https://paymenthub.terra-lead.co/pay/ord_8m2k4q7x9c1v3b5n6z0w2e4r",
"upi_intent": "upi://pay?pa=yourshop@bank&pn=Your%20Shop&tr=t5f2c9a1e7b3d4086c1a2&am=499.00&cu=INR",
"utr": null,
"failure": null,
"description": "Order 1042",
"customer": {
"name": "Asha Rao",
"email": null,
"phone": "9876543210"
},
"metadata": {
"cart_id": "c_77"
},
"created_at": "2026-10-25T10:30:00.000Z",
"expires_at": "2026-10-25T10:45:00.000Z",
"paid_at": null
}The order object
Every answer about an order, and every webhook, carries the same object.
- idstring
- The order's id: ord_ and 24 letters and digits. Read the order by it, or by your reference.
- referencestring
- Your reference, as you sent it.
- statusstring
- PENDING, SUCCESS, FAILED or EXPIRED. See Statuses.
- amountinteger
- The amount asked for, in paise.
- amount_paidinteger | null
- What was paid, in paise, once the order is paid.
- currencystring
- "INR".
- flowstring
- "INTENT" or "P2P": how the customer pays.
- modestring
- "test" or "live", from the key that made it.
- checkoutstring
- "H2H": upi_intent is set and you may show it in your own page. "REDIRECT": send the customer to pay_url.
- pay_urlstring
- The hosted pay page for this order. Works for every order.
- upi_intentstring | null
- A upi://pay link for H2H orders. Use it exactly as given.
- utrstring | null
- The bank reference (UTR) of the payment, once paid, when known.
- failureobject | null
- For a FAILED order: { code, message } saying why.
- descriptionstring | null
- Your description.
- customerobject
- { name, email, phone } as you sent them, or null.
- metadataobject
- Your metadata, as you sent it.
- created_atstring
- When the order was made (ISO 8601, UTC).
- expires_atstring
- When the time to pay ends.
- paid_atstring | null
- When it was paid.
Statuses
- PENDING
- Waiting for the customer. Show the pay page and wait for the webhook. Don't deliver anything yet.
- SUCCESS
- Paid. Final: it never changes again. Check the amount and your reference, then deliver.
- FAILED
- The payment did not go through. The customer can start again with a new order (a new reference).
- EXPIRED
- The time to pay ended without a payment. The customer can start again with a new order.
Money can arrive late: the customer's bank may take longer than the time to pay. A FAILED or EXPIRED order then becomes SUCCESS, and you get an order.success webhook after the earlier one. Don't treat FAILED or EXPIRED as final in a way you cannot undo, and if the customer has already paid again on a new order, refund one of them.
Showing the payment
The order's checkout says how the customer can pay. pay_url works for every order: send the customer there and the page does the rest, on phones and computers, and returns them to your return_url.
H2H: in your own page
With "checkout": "H2H" the order has a upi_intent, a upi://pay link. On a phone, make it a link or a button: it opens the customer's UPI app with the amount filled in. On a computer, show it as a QR code to scan with a phone. Use the link exactly as given; changing any part of it can stop the payment being matched.
<!-- On a phone: a link that opens the customer's UPI app -->
<a href="{{upi_intent}}">Pay with a UPI app</a>
<!-- On a computer: the same link as a QR code, made with any QR library -->
<div id="qr"></div>
<script>
// e.g. qrcode.js: new QRCode(document.getElementById("qr"), order.upi_intent);
</script>P2P orders are always H2H: the customer scans and pays a UPI ID, and must pay the exact amount, paise included.
Redirect
With "checkout": "REDIRECT" there is no UPI link: send the customer to pay_url. From there they finish on a secure payment page and come back to your return_url.
Either way, the status added to your return URL is for showing the right screen only. Deliver on the webhook (or on reading the order), never on the return URL alone.
Read an order
GET/v1/orders/{id or reference}
The order, by its ord_… id or by your reference, in the mode of the key you use. While a live order waits, reading it also asks the payment processor for news, so polling shows the latest. Webhooks are still the better way to hear about a payment: poll every 10–30 seconds at most.
# By the order's id or by your own reference
curl "https://paymenthub.terra-lead.co/v1/orders/ord_8m2k4q7x9c1v3b5n6z0w2e4r" \
-H "Authorization: Bearer $SECRET_KEY"
curl "https://paymenthub.terra-lead.co/v1/orders/INV-1042" \
-H "Authorization: Bearer $SECRET_KEY"The customer's bank reference (UTR)
POST/v1/orders/{id or reference}/utr
A UPI payment is usually confirmed within a minute. When a customer says they paid but the order still waits, or it has already expired, send the 12-digit bank reference (UTR) from their UPI app. The order is paid only when a payment with exactly that UTR, the order's amount and the order's UPI ID has reached us. If it has not reached us yet, the UTR is kept: the order is paid as soon as that payment arrives, and our team checks a claim that stays waiting. The pay page offers the same to the customer, and your dashboard's order page has a "Customer says they paid" box.
curl -X POST "https://paymenthub.terra-lead.co/v1/orders/INV-1042/utr" \
-H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "utr": "412345678901" }'200with"status": "SUCCESS": the payment was found and the order is paid.200with"status": "WAITING": the UTR is kept, and the order is paid as soon as that payment reaches us.- A
422with a code when that UTR cannot be this order's payment; the message says why.
{
"status": "WAITING",
"message": "Thanks. The order is confirmed as soon as the payment with this UTR reaches us, usually within a minute.",
"order": {
"id": "ord_8m2k4q7x9c1v3b5n6z0w2e4r",
"reference": "INV-1042",
"status": "PENDING",
"amount": 49900,
"amount_paid": null,
"currency": "INR",
"flow": "P2P",
"mode": "live",
"checkout": "H2H",
"pay_url": "https://paymenthub.terra-lead.co/pay/ord_8m2k4q7x9c1v3b5n6z0w2e4r",
"upi_intent": "upi://pay?pa=yourshop@bank&pn=Your%20Shop&tr=t5f2c9a1e7b3d4086c1a2&am=499.00&cu=INR",
"utr": null,
"failure": null,
"description": "Order 1042",
"customer": {
"name": "Asha Rao",
"email": null,
"phone": "9876543210"
},
"metadata": {
"cart_id": "c_77"
},
"created_at": "2026-10-25T10:30:00.000Z",
"expires_at": "2026-10-25T10:45:00.000Z",
"paid_at": null
}
}- UTR_INVALIDHTTP 422
- Enter the 12-digit UTR (UPI reference number) shown in the UPI app.
- NOT_P2PHTTP 422
- This payment is confirmed automatically; no UTR is needed.
- ORDER_PAIDHTTP 422
- This order is already paid.
- UTR_USEDHTTP 422
- That UTR has already paid another order. Check the number in the UPI app.
- UTR_WRONG_ACCOUNTHTTP 422
- The payment with that UTR was made to a different UPI ID than this order's.
- UTR_AMOUNT_MISMATCHHTTP 422
- The payment with that UTR is for a different amount than this order.
- UTR_BEFORE_ORDERHTTP 422
- The payment with that UTR was made before this order was created.
- UTR_TOO_LATEHTTP 422
- The payment with that UTR was made too long after this order was created. Contact support to have it checked.
- UTR_REVIEWEDHTTP 422
- The payment with that UTR was checked and is not for an order. Contact support.
- UTR_TOO_MANYHTTP 429
- Too many UTRs were sent for this order. Contact support with the payment screenshot.
Webhooks
When an order is paid, fails or runs out of time, we send a POST to the order's callback_url, or else to your account's pay-in webhook URL. If your account is set to send only successful payments, you get only order.success.
- order.success
- The order is paid. Sent again if a FAILED or EXPIRED order is paid late.
- order.failed
- The payment did not go through.
- order.expired
- The time to pay ended without a payment.
The request
- Webhook-Id
- The event's id. The same on every retry of one event: use it to skip an event you have already handled.
- Webhook-Event
- The event type, also in the body.
- Webhook-Signature
- t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>" with your webhook signing secret>
- Body
- { id, type, created_at, data }, where data is the order object, the same as reading the order.
{
"id": "evt_4h7k2m9p3q8r1s6t5v0w2x4y",
"type": "order.success",
"created_at": "2026-10-25T10:31:35.412Z",
"data": {
"id": "ord_8m2k4q7x9c1v3b5n6z0w2e4r",
"reference": "INV-1042",
"status": "SUCCESS",
"amount": 49900,
"amount_paid": 49900,
"currency": "INR",
"flow": "INTENT",
"mode": "live",
"checkout": "H2H",
"pay_url": "https://paymenthub.terra-lead.co/pay/ord_8m2k4q7x9c1v3b5n6z0w2e4r",
"upi_intent": "upi://pay?pa=yourshop@bank&pn=Your%20Shop&tr=t5f2c9a1e7b3d4086c1a2&am=499.00&cu=INR",
"utr": "429817365012",
"failure": null,
"description": "Order 1042",
"customer": {
"name": "Asha Rao",
"email": null,
"phone": "9876543210"
},
"metadata": {
"cart_id": "c_77"
},
"created_at": "2026-10-25T10:30:00.000Z",
"expires_at": "2026-10-25T10:45:00.000Z",
"paid_at": "2026-10-25T10:31:35.000Z"
}
}Check the signature
Check every webhook before you act on it. Use the body exactly as it arrived (parsing and writing the JSON again changes it), and refuse a t more than 5 minutes from your clock.
import crypto from "node:crypto";
// Webhook-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>
export function verifyWebhook(secret, header, rawBody, toleranceSec = 300) {
const parts = Object.fromEntries(
String(header).split(",").map((p) => p.trim().split("=", 2)),
);
const t = Number(parts.t);
if (!Number.isFinite(t) || !parts.v1) return false;
if (Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
const expected = crypto
.createHmac("sha256", secret)
.update(`${t}.`)
.update(rawBody) // a Buffer or string: the body exactly as received
.digest("hex");
const a = Buffer.from(parts.v1);
const b = Buffer.from(expected);
return a.length === b.length && crypto.timingSafeEqual(a, b);
}<?php
// Webhook-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>
function verify_webhook(string $secret, string $header, string $rawBody, int $tolerance = 300): bool
{
$parts = [];
foreach (explode(",", $header) as $piece) {
$kv = explode("=", trim($piece), 2);
if (count($kv) === 2) {
$parts[$kv[0]] = $kv[1];
}
}
if (!isset($parts["t"], $parts["v1"]) || !ctype_digit($parts["t"])) {
return false;
}
$t = (int) $parts["t"];
if (abs(time() - $t) > $tolerance) {
return false;
}
$expected = hash_hmac("sha256", $t . "." . $rawBody, $secret);
return hash_equals($expected, $parts["v1"]);
}import hashlib
import hmac
import time
# Webhook-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>
def verify_webhook(secret, header, raw_body, tolerance=300):
parts = dict(p.strip().split("=", 1) for p in header.split(",") if "=" in p)
try:
t = int(parts["t"])
except (KeyError, ValueError):
return False
if "v1" not in parts or abs(time.time() - t) > tolerance:
return False
signed = f"{t}.".encode() + raw_body # raw_body: bytes, exactly as received
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])import express from "express";
import { verifyWebhook } from "./verify-webhook.js";
const app = express();
// Keep the raw body: JSON parsed and written again would not match the signature.
app.post("/webhooks/payments", express.raw({ type: "application/json" }), (req, res) => {
const ok = verifyWebhook(process.env.WEBHOOK_SECRET, req.get("Webhook-Signature") ?? "", req.body);
if (!ok) return res.status(400).send("bad signature");
const event = JSON.parse(req.body.toString("utf8"));
// The same event can arrive twice: skip a Webhook-Id you have already handled.
if (event.type === "order.success") {
// Check event.data.reference and event.data.amount, then mark your order paid.
}
res.sendStatus(200);
});
app.listen(3000);$rawBody = file_get_contents("php://input"); // the body exactly as received
$header = $_SERVER["HTTP_WEBHOOK_SIGNATURE"] ?? "";
if (!verify_webhook(getenv("WEBHOOK_SECRET"), $header, $rawBody)) {
http_response_code(400);
exit("bad signature");
}
$event = json_decode($rawBody, true);
// The same event can arrive twice: skip a Webhook-Id you have already handled.
if ($event["type"] === "order.success") {
// Check $event["data"]["reference"] and the amount, then mark your order paid.
}
http_response_code(200);import os
from flask import Flask, request
app = Flask(__name__)
@app.post("/webhooks/payments")
def payments_webhook():
raw = request.get_data() # bytes, exactly as received
if not verify_webhook(os.environ["WEBHOOK_SECRET"], request.headers.get("Webhook-Signature", ""), raw):
return "bad signature", 400
event = request.get_json()
# The same event can arrive twice: skip a Webhook-Id you have already handled.
if event["type"] == "order.success":
pass # Check event["data"]["reference"] and the amount, then mark your order paid.
return "", 200Answer and retries
Answer with any 2xx within 10 seconds; do slow work after answering. Anything else (an error, a redirect, no answer) is tried again: 7 attempts in all, at once and then after 1 min, 5 min, 15 min, 1 h, 6 h, 24 h. The same event can reach you more than once, and events can arrive out of order: read the order if in doubt.
Errors
A refused request answers with an HTTP status and a body you can show in your logs:
{
"code": "AMOUNT_TOO_LOW",
"message": "The minimum is 100 paise",
"details": {
"field": "amount",
"limit": 100
}
}code is stable: match on it. message is plain words and can change. details is there when there is more to say, such as the field or the limit.
- INVALID_REQUESTHTTP 400
- The body is not JSON, or a field is wrong. message and details.field say which. Fix the request.
- UNAUTHORIZEDHTTP 401
- The key is missing, wrong or revoked, or was sent to another business's address.
- IP_NOT_ALLOWEDHTTP 403
- A live key used from a server address that is not on your list. Add the address in your dashboard.
- PAYIN_NOT_ENABLEDHTTP 403
- Taking payments is not switched on for your account.
- ACCOUNT_SUSPENDEDHTTP 403
- Your account is suspended. Contact support.
- ACCOUNT_CLOSEDHTTP 403
- Your account is closed.
- LIVE_NOT_ENABLEDHTTP 403
- A live key, before live payments are switched on for your account.
- FLOW_NOT_ENABLEDHTTP 403
- flow asks for a way of paying your account does not take.
- NOT_FOUNDHTTP 404
- No order with that id or reference for this key's mode (or no such endpoint).
- REFERENCE_REUSEDHTTP 409
- The reference was already used for a different amount. Use a new reference.
- AMOUNT_TOO_LOWHTTP 422
- Below your account's minimum. details.limit is the minimum in paise.
- AMOUNT_TOO_HIGHHTTP 422
- Above your account's maximum, or the UPI limit. details.limit is the maximum in paise.
- DAILY_LIMITHTTP 429
- Today's amount or number of payments for your account is reached (the day is India time). details.limit says which.
- PAYMENT_NOT_CREATEDHTTP 502
- The payment processor could not create the payment. No order was made: try again with the same reference.
- NO_ACCOUNT_AVAILABLEHTTP 503
- No payment account can take this payment right now. details.reason says why: DAILY_LIMIT_REACHED (today's limit is used up: try after the next opening), OUTSIDE_HOURS, PAUSED (contact support), AMOUNT_NOT_ACCEPTED (try another amount), CUSTOMER_UPI_REQUIRED (send the customer's UPI ID), ACCOUNT_ON_HOLD (try in 5 minutes), PROCESSOR_NOT_RESPONDING (try in a minute) or NOT_AVAILABLE. The message says it in words.
- RETRYHTTP 503
- A rare clash. Send the same request again.
- INTERNALHTTP 500
- Something went wrong on our side. Send the same request again; the reference keeps it safe.
Test mode
Orders made with a sk_test_… key are test orders: no payment account is used and no money moves. Their pay page says "Test payment" and has two buttons, Simulate success and Simulate failure, that settle the order the way a real payment would, webhook included (with "mode": "test"). A test P2P order is also paid by sending any 12-digit UTR.
Before you go live, take one order through each outcome and check that your server handles the webhook and the return.
Payouts
Payouts send money from your payout balance (the money you add for payouts: your collections are not used) to bank accounts and UPI IDs, and, when your account has them, to USDT wallets: your customers' withdrawals, refunds to a bank account, payments to suppliers. First you add who you pay (a beneficiary), then you send payouts to it. A signed webhook tells your server when each one is paid, fails, or comes back from the bank.
- Add a beneficiary once: a bank account (account number and IFSC), a UPI ID, or a USDT wallet (network and address). Keep its
ben_…id. - Send a payout to it with your own reference and the amount in paise.
- Wait for the
payout.successwebhook (or read the payout) before you treat it as paid.
The same keys work as for orders: sk_test_… for test payouts that move no money, sk_live_… for real ones. Test and live beneficiaries and payouts are separate lists. You can also add beneficiaries and send payouts from your dashboard.
Live payouts come only from your servers
With a live key, adding a beneficiary or sending a payout needs your servers' IP addresses on file in your dashboard (until then they are refused with PAYOUT_IP_LIST_MISSING), and a request from any other address is refused with IP_NOT_ALLOWED. Test keys are not limited.
Beneficiaries
POST/v1/beneficiaries
# A bank account
curl -X POST "https://paymenthub.terra-lead.co/v1/beneficiaries" \
-H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Asha Rao", "account_number": "001234567890", "ifsc": "HDFC0001234" }'
# A UPI ID
curl -X POST "https://paymenthub.terra-lead.co/v1/beneficiaries" \
-H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Ravi Kumar", "vpa": "ravi.kumar@okicici" }'
# A USDT wallet (when USDT payouts are open to your account)
curl -X POST "https://paymenthub.terra-lead.co/v1/beneficiaries" \
-H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Vendor Treasury", "network": "TRC20", "wallet_address": "TRx7Wk2pQm9Vd4Zs8Hc3Nb6Yf5Gt1Ju2Ka" }'const res = await fetch("https://paymenthub.terra-lead.co/v1/beneficiaries", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ name: "Asha Rao", account_number: "001234567890", ifsc: "HDFC0001234" }),
});
const beneficiary = await res.json();
if (!res.ok) throw new Error(`${beneficiary.code}: ${beneficiary.message}`);
// Keep beneficiary.id. A live one is "PENDING" until it is approved.<?php
$ch = curl_init("https://paymenthub.terra-lead.co/v1/beneficiaries");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SECRET_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Asha Rao",
"account_number" => "001234567890",
"ifsc" => "HDFC0001234",
]),
]);
$beneficiary = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception($beneficiary["code"] . ": " . $beneficiary["message"]);
}
// Keep $beneficiary["id"]. A live one is "PENDING" until it is approved.import os
import requests
res = requests.post(
"https://paymenthub.terra-lead.co/v1/beneficiaries",
headers={"Authorization": f"Bearer {os.environ['SECRET_KEY']}"},
json={"name": "Asha Rao", "account_number": "001234567890", "ifsc": "HDFC0001234"},
timeout=30,
)
beneficiary = res.json()
if res.status_code >= 400:
raise RuntimeError(f"{beneficiary['code']}: {beneficiary['message']}")
# Keep beneficiary["id"]. A live one is "PENDING" until it is approved.Request fields
- kindstring
- "BANK", "UPI" or "USDT". Left out: worked out from the fields you send.
- namestring, required
- Who the money is for, 2–100 characters: letters, digits, spaces and . , & ' ( ) / -
- account_numberstring
- Bank beneficiaries: 6–18 digits, as a string (spaces and - are removed). Only the last 4 are ever shown again.
- ifscstring
- Bank beneficiaries: the branch's 11-character IFSC, like HDFC0001234.
- vpastring
- UPI beneficiaries: the UPI ID, like name@bank.
- wallet_addressstring
- USDT beneficiaries: the wallet's address. T and 33 more characters on TRC20; 0x and 40 hex digits on ERC20 and BEP20. Copy it from the wallet: USDT sent to a wrong address can't be brought back.
- networkstring
- USDT beneficiaries: the network the wallet takes USDT on: "TRC20" (Tron (TRC-20)), "ERC20" (Ethereum (ERC-20)), "BEP20" (BNB Smart Chain (BEP-20)). The networks open to you are listed in your dashboard.
The answer
201 with the beneficiary. Adding the same details again (same mode, not switched off) answers 200 with the first one, so it is safe to retry. A test beneficiary is APPROVED at once. A live one is PENDING while it is checked; payouts to it can start once it is APPROVED. If your account is set up for direct payouts, a live bank account or UPI ID is APPROVED at once too; a USDT wallet is always checked first.
Bank details never change: to change them, add a new beneficiary. A beneficiary is never deleted, only switched off (DISABLED) in your dashboard.
{
"id": "ben_3k7m2q9x4c8v1b6n5z0w2e4r",
"kind": "BANK",
"name": "Asha Rao",
"account_last4": "7890",
"ifsc": "HDFC0001234",
"vpa": null,
"wallet_address": null,
"network": null,
"status": "APPROVED",
"mode": "live",
"created_at": "2026-10-25T11:00:00.000Z"
}{
"id": "ben_6t1v4x8z2b5d9f3h7k0m2p4q",
"kind": "UPI",
"name": "Ravi Kumar",
"account_last4": null,
"ifsc": null,
"vpa": "ravi.kumar@okicici",
"wallet_address": null,
"network": null,
"status": "APPROVED",
"mode": "live",
"created_at": "2026-10-25T11:00:00.000Z"
}{
"id": "ben_8w2y5a9c3e7g1j4l6n0q2s4u",
"kind": "USDT",
"name": "Vendor Treasury",
"account_last4": null,
"ifsc": null,
"vpa": null,
"wallet_address": "TRx7Wk2pQm9Vd4Zs8Hc3Nb6Yf5Gt1Ju2Ka",
"network": "TRC20",
"status": "APPROVED",
"mode": "live",
"created_at": "2026-10-25T11:00:00.000Z"
}- idstring
- The beneficiary's id: ben_ and 24 letters and digits. Pay it with beneficiary_id.
- kindstring
- "BANK", "UPI" or "USDT".
- namestring
- The name you sent.
- account_last4string | null
- The last 4 digits of the account number (bank beneficiaries).
- ifscstring | null
- The IFSC (bank beneficiaries).
- vpastring | null
- The UPI ID (UPI beneficiaries).
- wallet_addressstring | null
- The wallet's address (USDT beneficiaries).
- networkstring | null
- TRC20, ERC20 or BEP20 (USDT beneficiaries).
- statusstring
- APPROVED: payouts can go to it. PENDING: a live beneficiary still being checked (a live bank account or UPI ID is APPROVED at once for an account set up for direct payouts; a USDT wallet is always checked). DISABLED: switched off.
- modestring
- "test" or "live", from the key that added it.
- created_atstring
- When it was added (ISO 8601, UTC).
List and read
GET/v1/beneficiaries
GET/v1/beneficiaries/{id}
The list is newest first, as { "data": [ … ], "has_more": false }. Filter with status and kind, take up to limit (1–100, default 50), and pass the last one's created_at as before for the next page.
# Newest first; ?status=APPROVED|PENDING|DISABLED, ?kind=BANK|UPI|USDT, ?limit=1-100, ?before=<created_at>
curl "https://paymenthub.terra-lead.co/v1/beneficiaries?status=APPROVED&limit=20" \
-H "Authorization: Bearer $SECRET_KEY"
curl "https://paymenthub.terra-lead.co/v1/beneficiaries/ben_3k7m2q9x4c8v1b6n5z0w2e4r" \
-H "Authorization: Bearer $SECRET_KEY"Send a payout
POST/v1/payouts
curl -X POST "https://paymenthub.terra-lead.co/v1/payouts" \
-H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"reference": "WD-1001",
"beneficiary_id": "ben_3k7m2q9x4c8v1b6n5z0w2e4r",
"amount": 50000,
"purpose": "Player withdrawal",
"callback_url": "https://shop.example/webhooks/payouts",
"metadata": { "user": "u-77" }
}'const res = await fetch("https://paymenthub.terra-lead.co/v1/payouts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
reference: "WD-1001", // your own id: retrying with it never pays twice
beneficiary_id: "ben_3k7m2q9x4c8v1b6n5z0w2e4r",
amount: 50000, // paise: ₹500.00
purpose: "Player withdrawal",
callback_url: "https://shop.example/webhooks/payouts",
metadata: { user: "u-77" },
}),
});
const payout = await res.json();
if (!res.ok) throw new Error(`${payout.code}: ${payout.message}`);
// payout.status is usually "PROCESSING" here: wait for the webhook before you mark it paid.<?php
$ch = curl_init("https://paymenthub.terra-lead.co/v1/payouts");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SECRET_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"reference" => "WD-1001", // your own id: retrying with it never pays twice
"beneficiary_id" => "ben_3k7m2q9x4c8v1b6n5z0w2e4r",
"amount" => 50000, // paise: ₹500.00
"purpose" => "Player withdrawal",
"callback_url" => "https://shop.example/webhooks/payouts",
"metadata" => ["user" => "u-77"],
]),
]);
$payout = json_decode(curl_exec($ch), true);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
throw new Exception($payout["code"] . ": " . $payout["message"]);
}
// $payout["status"] is usually "PROCESSING" here: wait for the webhook.import os
import requests
res = requests.post(
"https://paymenthub.terra-lead.co/v1/payouts",
headers={"Authorization": f"Bearer {os.environ['SECRET_KEY']}"},
json={
"reference": "WD-1001", # your own id: retrying with it never pays twice
"beneficiary_id": "ben_3k7m2q9x4c8v1b6n5z0w2e4r",
"amount": 50000, # paise: ₹500.00
"purpose": "Player withdrawal",
"callback_url": "https://shop.example/webhooks/payouts",
"metadata": {"user": "u-77"},
},
timeout=30,
)
payout = res.json()
if res.status_code >= 400:
raise RuntimeError(f"{payout['code']}: {payout['message']}")
# payout["status"] is usually "PROCESSING" here: wait for the webhook.Request fields
- referencestring, required
- Your own id for this payout, 1–64 characters: letters, digits and _ . : - /. Unique per mode. Sending the same reference, amount and beneficiary again returns the same payout, so a retry never pays twice.
- beneficiary_idstring, required
- An APPROVED beneficiary of the same mode (ben_…).
- amountinteger, required
- In paise, at least 100 (₹1.00), or your account's own minimum if it has one. Whole numbers only. For a USDT wallet too it is rupees: what the payout costs; the wallet gets the USDT it buys at today's rate.
- currencystring
- "INR", the only currency. May be left out.
- railstring
- IMPS, NEFT, RTGS, UPI or USDT. Left out: USDT for a USDT wallet, UPI for a UPI beneficiary, else IMPS (NEFT above ₹5,00,000); if your account is limited to some rails, the first of those that fits. UPI only for UPI beneficiaries, up to ₹1,00,000; USDT only for USDT wallets; IMPS up to ₹5,00,000; RTGS from ₹2,00,000.
- purposestring
- 1–40 characters: letters, digits, spaces and . _ -. Left out: "Payout".
- callback_urlstring
- Where this payout's webhooks go. Left out: your account's payout webhook URL, or its pay-in URL when no separate payout URL is set.
- metadataobject
- Up to 20 keys of your own (names up to 40 characters; values are strings up to 200 characters, numbers or true / false), returned on the payout and in webhooks.
The reference keeps it safe to retry
201 with the new payout. Sending the same reference with the same amount and beneficiary again answers 200 with the same payout: nothing is sent twice, and a retry is never refused by a limit. So when a request times out, send exactly the same request again. The same reference with another amount or beneficiary is refused with REFERENCE_REUSED. References are kept per mode: one used in test mode is free in live mode.
Your balance is charged the amount, your payout fee and GST on the fee (fee and tax on the payout). A payout above your account's approval amount waits as ON_HOLD until it is approved; its money is set aside meanwhile.
{
"id": "po_9h2k5m8p3q7r1s4t6v0w2x4y",
"reference": "WD-1001",
"status": "PROCESSING",
"amount": 50000,
"fee": 500,
"tax": 90,
"currency": "INR",
"mode": "live",
"rail": "IMPS",
"purpose": "Player withdrawal",
"beneficiary": {
"id": "ben_3k7m2q9x4c8v1b6n5z0w2e4r",
"name": "Asha Rao",
"account_last4": "7890",
"ifsc": "HDFC0001234",
"vpa": null,
"wallet_address": null,
"network": null
},
"utr": null,
"usdt": null,
"failure": null,
"metadata": {
"user": "u-77"
},
"created_at": "2026-10-25T11:00:00.000Z",
"updated_at": "2026-10-25T11:00:00.000Z"
}Read a payout
GET/v1/payouts/{id or reference}
The payout, by its po_… id or by your reference, in the mode of the key you use. While it is PROCESSING, reading it also asks the bank for news (at most every 10 seconds), so polling shows the latest. Webhooks are still the better way to hear the outcome.
# By the payout's id or by your own reference
curl "https://paymenthub.terra-lead.co/v1/payouts/po_9h2k5m8p3q7r1s4t6v0w2x4y" \
-H "Authorization: Bearer $SECRET_KEY"
curl "https://paymenthub.terra-lead.co/v1/payouts/WD-1001" \
-H "Authorization: Bearer $SECRET_KEY"USDT payouts
When USDT payouts are open to your account, a USDT wallet beneficiary is paid in USDT. Add the wallet with its network (TRC20, ERC20 or BEP20) and wallet_address, then send a payout to it as to any beneficiary. The rail is USDT, chosen for you.
The amount is still rupees, in paise: what the payout costs your balance (with its fee). The wallet gets the USDT that amount buys at today's rate, rounded down to a cent of USDT. The rate is locked on the payout when it is made, and the payout says what was sent in usdt:
- usdt.network
- TRC20, ERC20 or BEP20: the wallet's network.
- usdt.rate
- Paise per 1 USDT. 8935 is ₹89.35 for one USDT.
- usdt.amount
- What the wallet gets, in cents of USDT. 11191 is 111.91 USDT.
- usdt.tx_hash
- The transfer's transaction hash on the network, once it is sent (null before). A USDT payout has no UTR.
# To a USDT wallet: the amount is still rupees, in paise (₹10,000.00 here).
# The wallet gets the USDT it buys at today's rate, rounded down to the cent.
curl -X POST "https://paymenthub.terra-lead.co/v1/payouts" \
-H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "reference": "VND-2207", "beneficiary_id": "ben_8w2y5a9c3e7g1j4l6n0q2s4u", "amount": 1000000, "purpose": "Supplier" }'{
"id": "po_4b8d2f6h0k3m7p1r5t9v2x6z",
"reference": "VND-2207",
"status": "SUCCESS",
"amount": 1000000,
"fee": 0,
"tax": 0,
"currency": "INR",
"mode": "live",
"rail": "USDT",
"purpose": "Supplier",
"beneficiary": {
"id": "ben_8w2y5a9c3e7g1j4l6n0q2s4u",
"name": "Vendor Treasury",
"account_last4": null,
"ifsc": null,
"vpa": null,
"wallet_address": "TRx7Wk…u2Ka",
"network": "TRC20"
},
"utr": null,
"usdt": {
"network": "TRC20",
"rate": 8935,
"amount": 11191,
"tx_hash": "9f2c4e6a8b0d1f3e5a7c9b1d3f5e7a9c0b2d4f6e8a1c3e5b7d9f0a2c4e6b8d0f"
},
"failure": null,
"metadata": {},
"created_at": "2026-10-25T11:00:00.000Z",
"updated_at": "2026-10-25T11:00:00.000Z"
}A rate is set for each day (India time). Until today's is set, a USDT payout is refused with USDT_RATE_UNAVAILABLE: nothing is made, so send the same request again later. An amount that buys less than 0.01 USDT is refused with AMOUNT_TOO_LOW. USDT sent to a wrong address or network can't be brought back, so check the wallet when you add it.
The payout object
Every answer about a payout, and every payout webhook, carries the same object.
- idstring
- The payout's id: po_ and 24 letters and digits. Read the payout by it, or by your reference.
- referencestring
- Your reference, as you sent it.
- statusstring
- ON_HOLD, PENDING, PROCESSING, SUCCESS, FAILED or REVERSED. See Payout statuses.
- amountinteger
- What the beneficiary gets, in paise.
- feeinteger
- Your payout fee, in paise (0 when no fee is set).
- taxinteger
- GST on the fee, in paise. Your balance is charged amount + fee + tax.
- currencystring
- "INR".
- modestring
- "test" or "live", from the key that made it.
- railstring
- How it is sent: IMPS, NEFT, RTGS, UPI or USDT.
- purposestring
- The purpose you sent, or "Payout".
- beneficiaryobject
- { id, name, account_last4, ifsc, vpa, wallet_address, network } of who is paid. The UPI ID and the wallet address are partly hidden.
- utrstring | null
- The bank reference (UTR) of the transfer, once the bank gives one. Not for USDT payouts: see usdt.tx_hash.
- usdtobject | null
- USDT payouts only, else null: { network, rate, amount, tx_hash }. rate is paise per 1 USDT, locked when the payout was made (8935 is ₹89.35). amount is what the wallet gets, in cents of USDT (11191 is 111.91 USDT), rounded down. tx_hash is the transfer's transaction hash on the network, once it is sent.
- failureobject | null
- For FAILED and REVERSED: { code, message } saying why. See the failure codes below.
- metadataobject
- Your metadata, as you sent it.
- created_atstring
- When the payout was made (ISO 8601, UTC).
- updated_atstring
- When it last changed.
failure
A FAILED or REVERSED payout says why in failure: a code to match on, and a message in plain words, with the reason the bank gave when there is one.
- PAYOUT_FAILED
- The transfer did not go through. No money left your balance.
- REJECTED
- This payout was not approved. No money left your balance.
- NOT_SENT
- This payout could not be sent. No money left your balance.
- REVERSED
- The bank returned this transfer. The amount is back in your balance.
{
"id": "po_9h2k5m8p3q7r1s4t6v0w2x4y",
"reference": "WD-1001",
"status": "FAILED",
"amount": 50000,
"fee": 500,
"tax": 90,
"currency": "INR",
"mode": "live",
"rail": "IMPS",
"purpose": "Player withdrawal",
"beneficiary": {
"id": "ben_3k7m2q9x4c8v1b6n5z0w2e4r",
"name": "Asha Rao",
"account_last4": "7890",
"ifsc": "HDFC0001234",
"vpa": null,
"wallet_address": null,
"network": null
},
"utr": null,
"usdt": null,
"failure": {
"code": "PAYOUT_FAILED",
"message": "The transfer did not go through. No money left your balance. Reason: Beneficiary account is closed"
},
"metadata": {},
"created_at": "2026-10-25T11:00:00.000Z",
"updated_at": "2026-10-25T11:00:00.000Z"
}Payout statuses
- ON_HOLD
- Above your account's approval amount: it waits for approval before it is sent. Its money is set aside. It becomes PENDING, or FAILED (code REJECTED) if it is not approved.
- PENDING
- Accepted and about to be sent.
- PROCESSING
- Sent; waiting for the bank. Not a failure: wait for the webhook, or read the payout.
- SUCCESS
- Paid. It can only change once more, to REVERSED, if the beneficiary's bank returns it.
- FAILED
- Final: it did not go through, and the whole amount (with the fee) is back in your balance. Send a new payout with a new reference if you still want to pay.
- REVERSED
- Final: the bank returned a paid payout. The amount is back in your balance; the fee is kept.
A payout moves one way: ON_HOLD → PENDING → PROCESSING → SUCCESS, and from SUCCESS only to REVERSED. Any step before SUCCESS can end in FAILED. A payout is failed only when the bank's answer is definite: one with no answer yet stays PROCESSING and is asked again, so never treat a slow payout as failed and pay the beneficiary another way.
Balance
GET/v1/balance
curl "https://paymenthub.terra-lead.co/v1/balance" \
-H "Authorization: Bearer $SECRET_KEY"{
"available": 3000000,
"on_hold": 50000,
"currency": "INR",
"mode": "live"
}- availableinteger
- Your payout balance: what can be paid out now, in paise. Only money added for payouts counts, never payments you collected; payouts on their way are already taken out.
- on_holdinteger
- Payouts on their way (waiting for approval, sent, not yet paid), in paise.
- currencystring
- "INR".
- modestring
- "test" or "live". Test keys see a fixed test balance.
This is your payout balance: the money added for your payouts (ask your account manager to add funds, or load it from your dashboard). Payments you collect are not part of it; they are settled to your bank account. A live payout is refused with INSUFFICIENT_BALANCE when the payout balance does not cover its amount, fee and tax. It can be held in more than one part, and one payout is paid from one part: a single payout close to your whole balance can be refused even when available covers it. Send it as two payouts.
Payout webhooks
When a payout is paid, fails or is returned, we send a POST to the payout's callback_url, or else to your account's payout webhook URL (or your pay-in URL when no separate payout URL is set). The headers, the signature and the retries are the same as for orders: check Webhook-Signature with the same function, and answer with any 2xx within 10 seconds (7 attempts in all, at once and then after 1 min, 5 min, 15 min, 1 h, 6 h, 24 h). If your account is set to send only successful payments, you get only payout.success.
- payout.success
- The payout is paid; utr is set when the bank gave one.
- payout.failed
- The payout did not go through (or was not approved). The money is back in your balance.
- payout.reversed
- The bank returned a paid payout. The amount is back in your balance.
{
"id": "evt_7c2m5q8t1w4z6b9e3h0k2n4r",
"type": "payout.success",
"created_at": "2026-10-25T11:00:42.318Z",
"data": {
"id": "po_9h2k5m8p3q7r1s4t6v0w2x4y",
"reference": "WD-1001",
"status": "SUCCESS",
"amount": 50000,
"fee": 500,
"tax": 90,
"currency": "INR",
"mode": "live",
"rail": "IMPS",
"purpose": "Player withdrawal",
"beneficiary": {
"id": "ben_3k7m2q9x4c8v1b6n5z0w2e4r",
"name": "Asha Rao",
"account_last4": "7890",
"ifsc": "HDFC0001234",
"vpa": null,
"wallet_address": null,
"network": null
},
"utr": "430912345678",
"usdt": null,
"failure": null,
"metadata": {
"user": "u-77"
},
"created_at": "2026-10-25T11:00:00.000Z",
"updated_at": "2026-10-25T11:00:42.000Z"
}
}app.post("/webhooks/payouts", express.raw({ type: "application/json" }), (req, res) => {
const ok = verifyWebhook(process.env.WEBHOOK_SECRET, req.get("Webhook-Signature") ?? "", req.body);
if (!ok) return res.status(400).send("bad signature");
const event = JSON.parse(req.body.toString("utf8"));
const payout = event.data; // the payout object, as GET /v1/payouts/{id} returns it
switch (event.type) {
case "payout.success":
// Mark payout.reference paid; keep payout.utr for your records.
break;
case "payout.failed":
// Nothing was paid and the money is back in your balance. payout.failure says why.
break;
case "payout.reversed":
// A paid payout came back from the bank: the amount is back in your balance.
break;
}
res.sendStatus(200);
});$rawBody = file_get_contents("php://input");
if (!verify_webhook(getenv("WEBHOOK_SECRET"), $_SERVER["HTTP_WEBHOOK_SIGNATURE"] ?? "", $rawBody)) {
http_response_code(400);
exit("bad signature");
}
$event = json_decode($rawBody, true);
$payout = $event["data"]; // the payout object
switch ($event["type"]) {
case "payout.success": // mark $payout["reference"] paid, keep $payout["utr"]
break;
case "payout.failed": // nothing paid; money back in your balance; see $payout["failure"]
break;
case "payout.reversed": // a paid payout came back: amount back in your balance
break;
}
http_response_code(200);@app.post("/webhooks/payouts")
def payouts_webhook():
raw = request.get_data()
if not verify_webhook(os.environ["WEBHOOK_SECRET"], request.headers.get("Webhook-Signature", ""), raw):
return "bad signature", 400
event = request.get_json()
payout = event["data"] # the payout object
if event["type"] == "payout.success":
pass # mark payout["reference"] paid, keep payout["utr"]
elif event["type"] == "payout.failed":
pass # nothing paid; money back in your balance; see payout["failure"]
elif event["type"] == "payout.reversed":
pass # a paid payout came back: amount back in your balance
return "", 200The same event can reach you more than once (skip a Webhook-Id you have handled), and a payout.reversed can follow a payout.success hours or days later.
Payout errors
Refusals have the same body as for orders: a stable code to match on, a plain message, and details when there is more to say.
{
"code": "INSUFFICIENT_BALANCE",
"message": "The payout balance is not enough for this payout and its fee",
"details": {
"field": "amount",
"required": 50590
}
}- INVALID_REQUESTHTTP 400
- The body is not JSON, or a field is wrong. message and details.field say which.
- UNAUTHORIZEDHTTP 401
- The key is missing, wrong or revoked, or was sent to another business's address.
- PAYOUT_NOT_ENABLEDHTTP 403
- Payouts are not switched on for your account.
- ACCOUNT_SUSPENDEDHTTP 403
- Your account is suspended. Contact support.
- ACCOUNT_CLOSEDHTTP 403
- Your account is closed.
- LIVE_NOT_ENABLEDHTTP 403
- A live payout before live payouts are switched on for your account.
- PAYOUT_IP_LIST_MISSINGHTTP 403
- A live key, and no server addresses on file. Send your servers' IP addresses to your account manager first.
- IP_NOT_ALLOWEDHTTP 403
- A live key used from a server address that is not on your list.
- NOT_FOUNDHTTP 404
- No payout or beneficiary with that id or reference for this key's mode.
- REFERENCE_REUSEDHTTP 409
- The reference was already used for a payout of another amount or beneficiary. Use a new reference.
- BENEFICIARY_NOT_FOUNDHTTP 422
- No beneficiary with that id in this mode (test and live beneficiaries are separate).
- BENEFICIARY_NOT_APPROVEDHTTP 422
- The beneficiary is still being checked. Payouts to it can start once it is approved.
- BENEFICIARY_DISABLEDHTTP 422
- The beneficiary is switched off.
- RAIL_NOT_ALLOWEDHTTP 422
- The rail does not fit the beneficiary or the amount (UPI needs a UPI beneficiary, USDT a USDT wallet; RTGS a large amount; IMPS a smaller one), is not one your account's payouts may use, or USDT does not go out on the wallet's network now.
- AMOUNT_TOO_LOWHTTP 422
- Below the minimum payout, yours or ours: details.limit is the minimum in paise. For a USDT wallet, also an amount that buys less than 0.01 USDT.
- AMOUNT_TOO_HIGHHTTP 422
- Above your account's maximum payout, or the UPI limit. details.limit is the maximum in paise.
- INSUFFICIENT_BALANCEHTTP 422
- Your balance is not enough for the amount, the fee and its tax. details.required is what it needs, in paise. If your payouts come from your collections, details.largest_single is the most one payout can take now (with its charge), and the message says so.
- DAILY_LIMITHTTP 429
- Today's payout amount for your account is reached (the day is India time). details.limit is the limit in paise.
- NO_ACCOUNT_AVAILABLEHTTP 503
- No payout can be sent right now. Nothing was made: try again shortly with the same reference.
- USDT_RATE_UNAVAILABLEHTTP 503
- No USDT rate is set for today yet, so USDT payouts can't be made. Nothing was made: try again later with the same reference.
- RETRYHTTP 503
- A rare clash. Send the same request again.
- INTERNALHTTP 500
- Something went wrong on our side. Send the same request again; the reference keeps it safe.
Test payouts
Payouts made with a sk_test_… key never reach a bank or a wallet and never touch your real balance: test keys see a fixed test balance. Test beneficiaries are ready at once, and test USDT payouts use today's rate, or a test rate when none is set. The amount's paise decide what happens, webhooks included (with "mode": "test"):
- … .99
- Paid at once: the answer is already SUCCESS, with a test UTR. For example 50099 (₹500.99).
- … .13
- Fails: the answer is FAILED with failure.code PAYOUT_FAILED. For example 25013 (₹250.13).
- anything else
- PROCESSING first, then paid about 10 seconds later. For example 50000 (₹500.00).
Before you go live, take one payout through each outcome and check that your server handles every webhook.
Key + Salt payouts
If your server is already built for a Key + Salt payout API, it can keep its code: the paths, fields, hashes, statuses and the signed callback below are that contract. Change the address, the Key and the Salt. Your account manager makes your Key + Salt and gives you the Salt once; the Key is also in your dashboard under Developer, Key + Salt. The Key decides the mode: mk_test_… for test payouts that move no money, mk_live_… for real ones. Test and live beneficiaries and payouts are separate lists.
- POST /api/v1/payouts/beneficiaries
- Register a beneficiary. Signed: beneficiary_ref|name|account_number|ifsc|upi_id
- POST /api/v1/payouts/create
- Create a payout. Signed: txnid|amount|beneficiary|rail|purpose (beneficiary = the beneficiary_ref or beneficiary_id you send)
- POST /api/v1/payouts/status
- A payout's status. Signed: the txnid (or payout_id) you send
Bodies are JSON (Content-Type: application/json) or a form, with key and hash among the fields. Live requests are accepted only from your servers' IP addresses on file; test keys work from anywhere.
Signing requests
Your pair is issued with one of two schemes, shown next to your Key in the dashboard. Both give lowercase hex.
Scheme 1 hash = SHA512( key|f1|f2|…|salt )
Scheme 2 hash = HMAC_SHA256( key = KEY + SALT , f1|f2|… )A field you leave out is signed as an empty string in its place: the | separators stay. amount is signed exactly as you send it ("1500" and "1500.00" are different strings).
Key mk_test_0123456789abcdef · Salt s3cr3t
txnid=PO-9001 amount=1500.00 beneficiary_ref=vendor-7 rail=IMPS purpose=vendor settlement
Scheme 1
string = mk_test_0123456789abcdef|PO-9001|1500.00|vendor-7|IMPS|vendor settlement|s3cr3t
hash = 6e1fd4c783fa6ba4999ec9ff9079d77b8ad232920b6fa403fc8da05196ae703909aa33bc79679c9048a233de516478336982876a310b06af3b857314b51f4b29
Scheme 2
message = PO-9001|1500.00|vendor-7|IMPS|vendor settlement
HMAC key = mk_test_0123456789abcdefs3cr3t
hash = 012477cde6d49e24ff12364e205aeb687d35056b1e88386433b796f90957c811Beneficiaries, payouts, status
Register a beneficiary
POST/api/v1/payouts/beneficiaries
- keystring, required
- Your Key.
- hashstring, required
- Over beneficiary_ref|name|account_number|ifsc|upi_id.
- beneficiary_refstring, required
- Your own id for who is paid, 1–40 letters, digits, _ or -. One set of details per ref: register changed details under a new ref.
- namestring, required
- The account holder's name (letters, digits, spaces and . , & ' ( ) / -).
- account_numberstring
- The bank account number (digits), with ifsc.
- ifscstring
- The branch's IFSC, like HDFC0001234 (upper-cased before signing).
- upi_idstring
- A UPI ID, like name@okhdfc. Send account_number + ifsc, or upi_id, or both.
- bank_namestring
- Optional, not signed.
Answers 201 with { beneficiary, reused: false }. A test beneficiary is APPROVED at once; a live one is PENDING until it is approved. Sending the same ref with the same details again answers 200 with its current status (reused: true), so the same call is your status check.
- beneficiary.beneficiary_idstring
- Its id (ben_…). Pay it by beneficiary_ref or by this id.
- beneficiary.beneficiary_refstring
- Your ref.
- beneficiary.statusstring
- APPROVED: payouts can go to it. PENDING: a live one still being checked. DISABLED: switched off.
- beneficiary.namestring
- The name registered.
- beneficiary.account_last4string | null
- The last 4 digits of the account number.
- beneficiary.ifscstring | null
- The IFSC.
- beneficiary.upi_idstring | null
- The UPI ID.
- beneficiary.livemodeboolean
- False when added with a test key. Test and live beneficiaries are separate lists.
Create a payout
POST/api/v1/payouts/create
KEY="mk_test_…"; SALT="…"
TXNID="PO-9001"; AMOUNT="1500.00"; REF="vendor-7"; RAIL="IMPS"; PURPOSE="vendor settlement"
# Scheme 2 (HMAC-SHA256)
HASH=$(printf '%s' "$TXNID|$AMOUNT|$REF|$RAIL|$PURPOSE" | openssl dgst -sha256 -hmac "$KEY$SALT" | sed 's/^.* //')
curl -X POST "https://paymenthub.terra-lead.co/api/v1/payouts/create" \
-H "Content-Type: application/json" \
-d "{ \"key\": \"$KEY\", \"txnid\": \"$TXNID\", \"amount\": \"$AMOUNT\", \"beneficiary_ref\": \"$REF\",
\"rail\": \"$RAIL\", \"purpose\": \"$PURPOSE\", \"hash\": \"$HASH\" }"import { createHmac } from "node:crypto";
const key = process.env.PAYOUT_KEY, salt = process.env.PAYOUT_SALT;
const p = { txnid: "PO-9001", amount: "1500.00", beneficiary_ref: "vendor-7", rail: "IMPS", purpose: "vendor settlement" };
const msg = [p.txnid, p.amount, p.beneficiary_ref, p.rail, p.purpose].map((v) => v ?? "").join("|");
const hash = createHmac("sha256", key + salt).update(msg).digest("hex"); // Scheme 2
const res = await fetch("https://paymenthub.terra-lead.co/api/v1/payouts/create", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ...p, key, hash }),
});
const out = await res.json();
if (!res.ok) throw new Error(`${out.code ?? res.status}: ${out.error}`);<?php
$key = getenv("PAYOUT_KEY"); $salt = getenv("PAYOUT_SALT");
$p = ["txnid" => "PO-9001", "amount" => "1500.00", "beneficiary_ref" => "vendor-7",
"rail" => "IMPS", "purpose" => "vendor settlement",
"notify_url" => "https://yoursite.com/payout-callback"];
$msg = $p["txnid"]."|".$p["amount"]."|".$p["beneficiary_ref"]."|".$p["rail"]."|".$p["purpose"];
$p["hash"] = hash_hmac("sha256", $msg, $key.$salt); // Scheme 2
// Scheme 1: hash("sha512", $key."|".$msg."|".$salt)
$p["key"] = $key;
$ch = curl_init("https://paymenthub.terra-lead.co/api/v1/payouts/create");
curl_setopt_array($ch, [CURLOPT_POST => 1, CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"], CURLOPT_POSTFIELDS => json_encode($p)]);
$res = json_decode(curl_exec($ch), true);
// 201 (or 200 with reused: true): $res["payout"]["status"], $res["payout"]["payout_id"]- keystring, required
- Your Key: mk_test_… for test payouts, mk_live_… for real ones.
- hashstring, required
- Over txnid|amount|beneficiary|rail|purpose (see Signing requests).
- txnidstring, required
- Your own id for this payout, 1–40 letters, digits, _ or -. Sending the same txnid, amount and beneficiary again returns the first payout (reused: true), so a retry never pays twice.
- amountstring, required
- Rupees as a string, at most two decimals: "1500" or "1500.50". Signed exactly as you send it.
- beneficiary_refstring
- The beneficiary_ref you registered. Send this or beneficiary_id.
- beneficiary_idstring
- Or the beneficiary_id (ben_…) a registration returned.
- railstring
- IMPS, NEFT, RTGS or UPI. Left out: IMPS for a bank account (NEFT above ₹5,00,000), UPI for a UPI-only beneficiary. A beneficiary with both is paid by UPI when you ask for UPI.
- purposestring
- Up to 50 characters. The payout keeps letters, digits, spaces and . _ - (other characters become spaces), at most 40.
- currencystring
- "INR", the only currency. May be left out.
- notify_urlstring
- Where this payout's callback goes. Left out: your account's payment messages address.
Answers 201 with { payout, reused, approval_required }. A timeout is not a failure: retry with the same txnid (you get the first payout back with reused: true) or ask for the status. A new txnid is a second payout.
{
"payout": {
"payout_id": "po_0123456789abcdefghjkmnpq",
"txnid": "PO-9001",
"status": "SUCCESS",
"terminal": true,
"amount": "1500.00",
"currency": "INR",
"rail": "IMPS",
"beneficiary_id": "ben_0123456789abcdefghjkmnpq",
"utr": "327012345470",
"failure_reason": null,
"livemode": false,
"created_at": "2026-10-30T10:40:59.020Z",
"completed_at": "2026-10-30T10:41:02.114Z"
},
"reused": false,
"approval_required": false
}- payout.payout_idstring
- The payout's id (po_…).
- payout.txnidstring
- Your txnid.
- payout.statusstring
- PROCESSING, ON_HOLD, SUCCESS, FAILED, REJECTED or REVERSED.
- payout.terminalboolean
- True for SUCCESS, FAILED, REJECTED and REVERSED. SUCCESS can still become REVERSED.
- payout.amountstring
- Rupees, two decimals.
- payout.currencystring
- "INR".
- payout.railstring
- How it is sent: IMPS, NEFT, RTGS or UPI.
- payout.beneficiary_idstring
- The beneficiary paid (ben_…).
- payout.utrstring | null
- The bank reference, once the bank gives one.
- payout.failure_reasonstring | null
- For FAILED, REJECTED and REVERSED: why, in plain words.
- payout.livemodeboolean
- False for test payouts.
- payout.created_atstring
- ISO 8601, UTC.
- payout.completed_atstring | null
- When it was paid or failed.
Payout status
POST/api/v1/payouts/status
Send key, hash and one of txnid or payout_id; the hash is over the one you send. Answers { payout }. A key only sees payouts of its own mode.
Statuses
- PROCESSING
- Accepted; on its way to the bank. Not a failure: wait for the callback, or ask for the status.
- ON_HOLD
- Waiting for approval before it is sent (above your account's approval amount).
- SUCCESS
- Paid. utr carries the bank reference.
- FAILED
- Not paid; failure_reason says why. The money is back in your balance.
- REJECTED
- Not approved. The money is back in your balance.
- REVERSED
- Paid, then returned by the beneficiary's bank. The amount is back in your balance.
Payout callback
When a payout reaches SUCCESS, FAILED, REJECTED or REVERSED, a JSON callback is POSTed to its notify_url (else your payment messages address), once per status. ORDER_ID is your txnid. Test payouts also carry LIVEMODE=false and are signed with your test Salt. Answer with any 2xx; a failed delivery is tried again (7 attempts in all, after 1 min, 5 min, 15 min, 1 h, 6 h, 24 h).
{
"EVENT": "payout.status",
"PAYOUT_ID": "po_0123456789abcdefghjkmnpq",
"ORDER_ID": "PO-9001",
"AMOUNT": "1500.00",
"CURRENCY_CODE": "356",
"STATUS": "SUCCESS",
"RAIL": "IMPS",
"UTR": "327012345470",
"FAILURE_REASON": "",
"RESPONSE_DATE_TIME": "2026-10-30T10:41:02.114Z",
"LIVEMODE": "false",
"HASH": "81ED89E25D02F170E9E13E929E92924017FB1E20C3EFDF26936D988DC5AF3A03"
}To check it: take every field except HASH, sort the names (byte order), join them as NAME=value with ~, append your Salt, SHA-256, upper-case hex, and compare with HASH. Keep empty values as NAME=, and hash whatever fields arrive: new ones may be added.
AMOUNT=1500.00~CURRENCY_CODE=356~EVENT=payout.status~FAILURE_REASON=~LIVEMODE=false~ORDER_ID=PO-9001~PAYOUT_ID=po_0123456789abcdefghjkmnpq~RAIL=IMPS~RESPONSE_DATE_TIME=2026-10-30T10:41:02.114Z~STATUS=SUCCESS~UTR=327012345470s3cr3timport { createHash, timingSafeEqual } from "node:crypto";
function callbackOk(body, salt) {
const s = Object.keys(body).filter((k) => k !== "HASH").sort()
.map((k) => `${k}=${body[k] ?? ""}`).join("~");
const want = Buffer.from(createHash("sha256").update(s + salt).digest("hex").toUpperCase());
const got = Buffer.from(String(body.HASH ?? "").toUpperCase());
return want.length === got.length && timingSafeEqual(want, got);
}<?php
$body = json_decode(file_get_contents("php://input"), true);
$fields = $body; unset($fields["HASH"]);
ksort($fields, SORT_STRING);
$pairs = [];
foreach ($fields as $k => $v) $pairs[] = $k . "=" . ($v ?? "");
$want = strtoupper(hash("sha256", implode("~", $pairs) . getenv("PAYOUT_SALT")));
if (!hash_equals($want, strtoupper($body["HASH"] ?? ""))) { http_response_code(400); exit; }
// $body["EVENT"] === "payout.status"; $body["ORDER_ID"] is your txnid; $body["STATUS"] …
http_response_code(200);Key + Salt errors
A refusal is { "error": "plain words", "code": "CODE" }. Switch on code and the HTTP status, never on the words.
- invalid keyHTTP 401
- { "error": "invalid key" } with no code: the Key is not recognised, was replaced by a new pair, or is used on another business's address.
- signature mismatchHTTP 401
- { "error": "signature mismatch" } with no code: the hash does not match. Check the scheme, the field order and that the amount is signed exactly as sent.
- INVALID_REQUESTHTTP 400
- A field is missing or wrong; error names it.
- LIVE_MODE_NOT_ACTIVATEDHTTP 403
- A live Key, before live payouts are switched on for your account.
- PAYOUT_NOT_ENABLEDHTTP 403
- Your account does not take payouts.
- PAYOUT_IP_LIST_MISSINGHTTP 403
- A live Key, and no server IP addresses on file. Your account manager adds them.
- PAYOUT_IP_NOT_ALLOWEDHTTP 403
- A live Key, from an address not on your list. Test keys are not limited.
- BENEFICIARY_NOT_FOUNDHTTP 404
- No beneficiary with that beneficiary_ref or beneficiary_id in this mode.
- NOT_FOUNDHTTP 404
- Status: no payout with that txnid or payout_id in this mode.
- BENEFICIARY_NOT_APPROVEDHTTP 409
- The beneficiary is still being checked.
- BENEFICIARY_REF_REUSEDHTTP 409
- That beneficiary_ref is registered with other details.
- REFERENCE_REUSEDHTTP 409
- That txnid was used for a payout with another amount or beneficiary.
- INSUFFICIENT_BALANCEHTTP 409
- Your balance does not cover the amount and its fee.
- RAIL_NOT_ALLOWEDHTTP 409
- The rail does not fit the beneficiary or the amount.
- AMOUNT_TOO_LOW / AMOUNT_TOO_HIGHHTTP 422
- Below the minimum, or above your account's limit or the UPI limit.
- DAILY_LIMITHTTP 429
- Your account's daily payout limit is reached.
- NO_ACCOUNT_AVAILABLE / RETRYHTTP 503
- Not sent now; retry with the same txnid.
Key + Salt pay-ins
If your server is already built for a Key + Salt order API, it can keep its code: the fields, hashes, answers, status and the signed callback below are that contract. Change the address, the Key and the Salt (the same pair as Key + Salt payouts, made under Developer, Key + Salt). The Key decides the mode: mk_test_… orders move no money and their pay page can simulate the outcome.
- POST /api/v1/intent/order
- An order paid through a payment processor (UPI link or its page)
- POST /api/v1/p2p/order
- An order paid straight to a UPI ID
- GET /api/v1/intent/order/{id}
- An Intent order's status (also /api/v1/p2p/order/{id} for P2P)
- GET /api/pay-status/{id}
- Any order's status; ?wait=1 holds the answer until the status changes (up to 25 s)
Bodies are JSON (Content-Type: application/json) or a form. Every answer carries an X-Request-Id header (yours, when you send one).
Signing
Scheme 1 hash = SHA512( key|txnid|amount|productinfo|firstname|email|||||||||||salt ) (ten empty fields)
Scheme 2 hash = HMAC_SHA256( key = KEY + SALT , txnid|amount|productinfo|email )Key mk_test_0123456789abcdef · Salt s3cr3t
txnid=ORDER-1001 amount=499.00 productinfo=Wallet top-up firstname=Asha email=asha@example.in
Scheme 2
message = ORDER-1001|499.00|Wallet top-up|asha@example.in
HMAC key = mk_test_0123456789abcdefs3cr3t
hash = 0173dbd6aabcdcf4ba30543169f9f4e3b25de332aabc196fd64410694ed910aa
Scheme 1
string = mk_test_0123456789abcdef|ORDER-1001|499.00|Wallet top-up|Asha|asha@example.in|||||||||||s3cr3t
hash = 63764131d16375d622530786407e3449f512ffff40e93fe90f2bac94f09d285fbda3ae9987c1e9f13d04c75fbe0716e9d6061bc531c312eac9430291d2961002A field you leave out is signed as an empty string in its place. amount is signed exactly as you send it: "499" and "499.00" are different strings.
Create an order (Key + Salt)
POST/api/v1/intent/order
KEY="mk_test_…"; SALT="…"
TXNID="ORDER-1001"; AMOUNT="499.00"; INFO="Wallet top-up"; EMAIL="asha@example.in"
# Scheme 2 (HMAC-SHA256)
HASH=$(printf '%s' "$TXNID|$AMOUNT|$INFO|$EMAIL" | openssl dgst -sha256 -hmac "$KEY$SALT" | sed 's/^.* //')
curl -X POST "https://paymenthub.terra-lead.co/api/v1/intent/order" \
-H "Content-Type: application/json" \
-d "{ \"key\": \"$KEY\", \"txnid\": \"$TXNID\", \"amount\": \"$AMOUNT\", \"productinfo\": \"$INFO\",
\"email\": \"$EMAIL\", \"notify_url\": \"https://yoursite.com/callback\", \"hash\": \"$HASH\" }"<?php
$key = getenv("PAY_KEY"); $salt = getenv("PAY_SALT");
$p = ["txnid" => "ORDER-1001", "amount" => "499.00", "productinfo" => "Wallet top-up",
"firstname" => "Asha", "email" => "asha@example.in",
"notify_url" => "https://yoursite.com/callback", "return_url" => "https://yoursite.com/thanks"];
$p["hash"] = hash_hmac("sha256", $p["txnid"]."|".$p["amount"]."|".$p["productinfo"]."|".$p["email"], $key.$salt);
$p["key"] = $key;
$ch = curl_init("https://paymenthub.terra-lead.co/api/v1/intent/order");
curl_setopt_array($ch, [CURLOPT_POST => 1, CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => ["Content-Type: application/json"], CURLOPT_POSTFIELDS => json_encode($p)]);
$res = json_decode(curl_exec($ch), true);
// 201 (200 with reused: true): show $res["upi_intent"] as a QR / app buttons, or send the customer to $res["pay_url"]- keystring, required
- Your Key: mk_test_… for test orders, mk_live_… for real ones. The same pair as Key + Salt payouts.
- txnidstring, required
- Your own id for this payment, up to 60 letters, digits and _ . : - /. Sending the same txnid and amount again returns the same order (reused: true), so a retry never charges twice.
- amountnumber | string, required
- Rupees, at most two decimals: 499, "499" or "499.00". Signed exactly as you send it.
- hashstring, required
- Over txnid|amount|productinfo|email (Scheme 2), or the longer Scheme 1 string (see below).
- productinfostring
- What is being paid for; signed. Shown on the order (first 100 characters).
- firstnamestring
- The customer's name; signed in Scheme 1.
- emailstring
- The customer's email; signed.
- phonestring
- The customer's phone, 10–13 digits.
- customer_vpastring
- The customer's own UPI ID, when you know it.
- client_ipstring
- The paying customer's IP address (not your server's).
- return_urlstring
- Where the customer's browser goes after paying on the pay page.
- notify_urlstring
- Where this order's callback goes. Left out: your account's payment messages address.
Answers 201 (the same txnid again: 200 with reused: true). With checkout: "H2H" show upi_intent on your own page as a QR (qr_payload) and app buttons (deeplinks); with REDIRECT send the customer to gateway_url. pay_url is the hosted pay page and works for either. order.id is the id to ask the status with.
{
"verified": true,
"merchant": "SHOP1",
"signed_by": "SHOP1",
"livemode": false,
"reused": false,
"flow": "INTENT",
"order": {
"id": "ord_0123456789abcdefghjkmnpq",
"order_id": "ORDER-1001",
"pay_id": "ord_0123456789abcdefghjkmnpq",
"vendor_txn_id": "t0123456789abcdef0123",
"sub_mid_code": null,
"amount": "499.00",
"currency_code": "INR",
"channel": "UPI_INTENT",
"status": "PENDING",
"created_at": "2026-11-02T10:00:00.000Z",
"livemode": false,
"channel_type": "INTENT"
},
"checkout": "H2H",
"deeplinks": {
"upi": "upi://pay?pa=shop.example@okaxis&pn=Shop%20One&am=499.00&tr=t0123456789abcdef0123",
"paytm": "paytmmp://pay?pa=shop.example@okaxis&…",
"phonepe": "phonepe://pay?pa=shop.example@okaxis&…"
},
"upi_intent": "upi://pay?pa=shop.example@okaxis&pn=Shop%20One&am=499.00&tr=t0123456789abcdef0123",
"qr_payload": "upi://pay?pa=shop.example@okaxis&pn=Shop%20One&am=499.00&tr=t0123456789abcdef0123",
"pay_url": "https://paymenthub.terra-lead.co/pay/ord_0123456789abcdefghjkmnpq"
}Order status (Key + Salt)
GET/api/pay-status/{id}
Public: the order id is the key. status is PENDING, SUCCESS, FAILED or EXPIRED; terminal is true for the last three. An EXPIRED or FAILED order can still turn SUCCESS if the money arrives late; a SUCCESS never changes. rrn is the bank reference once paid.
{
"scan_only": false,
"static_qr": null,
"payment_held": false,
"confirming": false,
"confirm_until": null,
"merchant_name": "Shop One",
"payee_vpa": "shop.example@okaxis",
"held": false,
"livemode": false,
"expires_at": "2026-11-02T10:15:00.000Z",
"completed_at": null,
"order_id": "ORDER-1001",
"amount": 499,
"currency_code": "INR",
"status": "PENDING",
"terminal": false,
"proof_submitted": false,
"rrn": null,
"mode": "QR",
"deeplinks": {
"upi": "upi://pay?pa=shop.example@okaxis&pn=Shop%20One&am=499.00&tr=t0123456789abcdef0123",
"paytm": "paytmmp://pay?pa=shop.example@okaxis&…",
"phonepe": "phonepe://pay?pa=shop.example@okaxis&…"
},
"upi_intent": "upi://pay?pa=shop.example@okaxis&pn=Shop%20One&am=499.00&tr=t0123456789abcdef0123",
"return_url": "https://yoursite.com/thanks",
"app_links": null,
"payment_page_url": null,
"checkout_url": null,
"checkout_methods": null,
"headless": null
}Pay-in callback
When an order is paid, fails or expires, a JSON callback is POSTed to its notify_url (else your payment messages address), once per status: an order told Expired and then paid is told Captured. ORDER_ID is your txnid; AMOUNT is what arrived. Test orders also carry LIVEMODE=false and are signed with your test Salt. Answer with any 2xx; a failed delivery is tried again (7 attempts in all, after 1 min, 5 min, 15 min, 1 h, 6 h, 24 h).
- STATUS=Captured, RESPONSE_CODE=000
- Paid. RRN is the bank reference.
- STATUS=Failed, RESPONSE_CODE=004
- Not paid.
- STATUS=Expired, RESPONSE_CODE=003
- Not paid in time. May still be followed by Captured.
{
"PAY_ID": "ord_0123456789abcdefghjkmnpq",
"ORDER_ID": "ORDER-1001",
"TXN_ID": "t0123456789abcdef0123",
"AMOUNT": "499",
"CURRENCY_CODE": "356",
"STATUS": "Captured",
"RESPONSE_CODE": "000",
"RRN": "630612345678",
"RESPONSE_DATE_TIME": "2026-11-02T10:02:11.000Z",
"LIVEMODE": "false",
"HASH": "AF4673D586DA6A2A29548ED4AEBC751E2B6916DF97279FCBD4FECD47C7195EDA"
}To check it: every field except HASH, names sorted (byte order), joined as NAME=value with ~, your Salt appended, SHA-256, upper-case hex.
AMOUNT=499~CURRENCY_CODE=356~LIVEMODE=false~ORDER_ID=ORDER-1001~PAY_ID=ord_0123456789abcdefghjkmnpq~RESPONSE_CODE=000~RESPONSE_DATE_TIME=2026-11-02T10:02:11.000Z~RRN=630612345678~STATUS=Captured~TXN_ID=t0123456789abcdef0123s3cr3timport { createHash, timingSafeEqual } from "node:crypto";
function callbackOk(body, salt) {
const s = Object.keys(body).filter((k) => k !== "HASH").sort()
.map((k) => `${k}=${body[k] ?? ""}`).join("~");
const want = Buffer.from(createHash("sha256").update(s + salt).digest("hex").toUpperCase());
const got = Buffer.from(String(body.HASH ?? "").toUpperCase());
return want.length === got.length && timingSafeEqual(want, got);
}
// body.ORDER_ID is your txnid; body.STATUS is Captured, Failed or Expired.Key + Salt pay-in errors
A refusal is { "error": "plain words", "code": "CODE" }. Switch on code and the HTTP status, never on the words.
- invalid keyHTTP 401
- { "error": "invalid key" } with no code: the Key is not recognised, was replaced, or is used on another business's address.
- SIGNATURE_MISMATCHHTTP 401
- { "error": "signature mismatch" }: the hash does not match. hint says what is signed; check the amount is signed exactly as sent.
- INVALID_REQUESTHTTP 400
- A field is missing or wrong. missing, invalid and hints (a field sent under another name) say which.
- LIVE_MODE_NOT_ACTIVATEDHTTP 403
- A live Key, before live payments are switched on for your account.
- PAYIN_NOT_ENABLED / MERCHANT_SUSPENDED / MERCHANT_BLOCKEDHTTP 403
- This account takes no payments now.
- IP_NOT_ALLOWEDHTTP 403
- A live Key from an address not on your pay-in server list (when you have one). Test keys are not limited.
- FLOW_NOT_ENABLEDHTTP 409
- The path's flow (intent or p2p) is not switched on for your account.
- TXNID_IN_USEHTTP 409
- That txnid was used for another amount.
- AMOUNT_BELOW_MIN / AMOUNT_ABOVE_MAXHTTP 422
- Outside your account's per-payment limits; field, limit and actual (rupees) say by how much.
- DAILY_LIMIT_EXCEEDEDHTTP 422
- Today's limit for your account is reached (India time).
- PAYMENT_NOT_CREATEDHTTP 502
- The payment processor could not create it. Retry with the same txnid.
- NO_ACCOUNT_AVAILABLEHTTP 503
- No payment account can take it right now. reason says why: DAILY_LIMIT_REACHED (today's limit is used up: try after the next opening), OUTSIDE_HOURS, PAUSED (contact support), AMOUNT_NOT_ACCEPTED (try another amount), CUSTOMER_UPI_REQUIRED (send the customer's UPI ID), ACCOUNT_ON_HOLD (try in 5 minutes), PROCESSOR_NOT_RESPONDING (try in a minute) or NOT_AVAILABLE; Retry-After (seconds) says when to retry, with the same txnid.