0% transaction fee · Direct Paytm settlement · Free to start Create account →
₹PayLink Gateway

API documentation

Create an order from your server, send your customer to the payment page, and get a signed webhook when the payment is done. Money goes straight to your own Paytm merchant account.

Base URL: https://www.orixpay.site

You need an account with the Paytm merchant connected. Create a free account, then open Connect Merchant. Your API key is in API Details. Ready client files for PHP, Node.js, Python and cURL are in SDK Downloads.

  1. Your server calls create-order.php and gets a pay_url.
  2. Redirect the customer to pay_url. They pay with Paytm UPI. The order expires in 5 minutes.
  3. We call your webhook with order.paid. You can also poll order-status.php.

Authentication

Send your API key with every request:

FieldValue
api_keyStarts with pk_live_. Send it as a form field, a JSON field or an Authorization: Bearer header. For order-status use the header (a key in the URL is rejected, it leaks into server logs). Keep it on your server. Never put it in a website or app.

You can create a new key any time in API Details. The old one stops working immediately.

Create an order

POSThttps://www.orixpay.site/api/create-order.php

Send a form body or JSON (Content-Type: application/json).

FieldRequiredDetails
amountYesRupees, from 1 to 100,000. Up to 2 decimals.
client_refNoYour own order id, up to 60 characters. Sending the same value again while the order is pending returns that same order with duplicate: true. After the order is paid or expired, the value cannot be reused.
customer_mobileNo10-digit Indian mobile number.
redirect_urlNohttp(s) address where the customer is sent after payment (auto, about 3 seconds after success). We add order_id, status and your client_ref to it. Do not trust these alone: confirm with order-status or the webhook before delivering.
noteNoUp to 200 characters.

Request

curl -X POST https://www.orixpay.site/api/create-order.php \
  -d "api_key=YOUR_API_KEY" \
  -d "amount=499" \
  -d "client_ref=INV-101" \
  -d "redirect_url=https://yourshop.com/thanks"

Response

{
  "status": true,
  "duplicate": false,
  "order_id": "ORD9F3A1C7E2B4D6A08",
  "client_ref": "INV-101",
  "amount": "499.00",
  "order_status": "pending",
  "pay_url": "https://yoursite.com/pay/checkout.php?o=ORD9F3A1C7E2B4D6A08",
  "expires_at": "2026-10-03 14:35:00"
}

Send the customer to pay_url.

Check an order

GEThttps://www.orixpay.site/api/order-status.php

Send order_id or client_ref. For a pending order we check the live status with Paytm before answering.

Request

curl -H "Authorization: Bearer YOUR_API_KEY" "https://www.orixpay.site/api/order-status.php?client_ref=INV-101"

Response

{
  "status": true,
  "order_id": "ORD9F3A1C7E2B4D6A08",
  "client_ref": "INV-101",
  "amount": "499.00",
  "order_status": "success",
  "utr": "412345678901",
  "payment_mode": "UPI",
  "paid_at": "2026-10-03 14:32:10",
  "expires_at": "2026-10-03 14:35:00"
}

utr, payment_mode and paid_at are null until the order is paid. Mark an order paid in your system only when order_status is success.

Order states

order_statusMeaning
pendingWaiting for the customer to pay.
successPaytm confirmed the payment. utr is filled.
expiredNot paid within 5 minutes. Create a new order.

Errors

Errors come as JSON with status: false and a readable message.

{ "status": false, "message": "Invalid API key." }
HTTPWhen
401API key is wrong.
404Order not found (order-status).
405create-order must be called with POST.
422A field is invalid, the Paytm merchant is not connected, client_ref is already used, or the merchant plan has expired. Read message.

Webhooks

Save an https address in Webhooks (it must be a public server). When an order is paid we send a POST with a JSON body:

{
  "event": "order.paid",
  "order_id": "ORD9F3A1C7E2B4D6A08",
  "client_ref": "INV-101",
  "amount": "499.00",
  "status": "success",
  "utr": "412345678901",
  "payment_mode": "UPI",
  "paid_at": "2026-10-03 14:32:10",
  "created_at": "2026-10-03 14:30:02"
}
HeaderValue
X-Webhook-Eventorder.paid (or test.ping for the test button)
X-Webhook-TimestampUnix time when we signed the request.
X-Webhook-Signaturev1= followed by HMAC-SHA256 hex of timestamp + "." + raw body, using your webhook secret.
X-Webhook-DeliveryId of this delivery.

Reply with any 2xx status to confirm. Otherwise we retry after 1 min, 5 min, 30 min, 2 h and 6 h (6 tries in total). The same event can arrive more than once, so make your handler safe to repeat.

Sign-check the raw body exactly as received. If you parse the JSON first and re-encode it, the signature will not match.

Verify the signature

PHP
$body = file_get_contents('php://input');
$ts   = $_SERVER['HTTP_X_WEBHOOK_TIMESTAMP'] ?? '';
$sig  = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '';
$calc = 'v1=' . hash_hmac('sha256', $ts . '.' . $body, 'YOUR_WEBHOOK_SECRET');

if (!hash_equals($calc, $sig) || abs(time() - (int)$ts) > 300) { http_response_code(400); exit; }

$event = json_decode($body, true);
if ($event['event'] === 'order.paid') {
    // mark $event['order_id'] as paid in your database (ignore it if it arrives again)
}
http_response_code(200); echo 'OK';
Node.js (Express)
const crypto = require('crypto');
// Use express.raw({ type: '*/*' }) so req.body is the untouched body
app.post('/paytm-webhook', express.raw({ type: '*/*' }), (req, res) => {
  const body = req.body.toString('utf8');
  const ts = req.get('X-Webhook-Timestamp') || '';
  const sig = req.get('X-Webhook-Signature') || '';
  const calc = 'v1=' + crypto.createHmac('sha256', 'YOUR_WEBHOOK_SECRET').update(ts + '.' + body).digest('hex');
  const ok = calc.length === sig.length && crypto.timingSafeEqual(Buffer.from(calc), Buffer.from(sig))
    && Math.abs(Date.now() / 1000 - Number(ts)) <= 300;
  if (!ok) return res.sendStatus(400);
  const event = JSON.parse(body);
  // handle event.order_id when event.event === 'order.paid'
  res.sendStatus(200);
});
Python (Flask)
import hashlib, hmac, time
from flask import Flask, request

@app.post("/paytm-webhook")
def paytm_webhook():
    body = request.get_data(as_text=True)
    ts = request.headers.get("X-Webhook-Timestamp", "")
    sig = request.headers.get("X-Webhook-Signature", "")
    calc = "v1=" + hmac.new(b"YOUR_WEBHOOK_SECRET", (ts + "." + body).encode(), hashlib.sha256).hexdigest()
    if not hmac.compare_digest(calc, sig) or abs(time.time() - int(ts or 0)) > 300:
        return "", 400
    event = request.get_json(force=True)
    # handle event["order_id"] when event["event"] == "order.paid"
    return "OK", 200

Go live checklist

  • Paytm merchant is connected and shows Connected.
  • API key is only on your server.
  • Your webhook URL is saved, the test event returns HTTP 200, and your handler checks the signature.
  • You mark an order paid only after success, and you handle a repeated event safely.
  • You use a unique client_ref for every order.

Create free account Log in