Merchant API v1
Base URL https://repohsc.com/api/v1. All responses are JSON with a success flag and either data or error.
Authentication
Create keys in the dashboard under API keys. The secret is shown once. Send both on every request:
X-Api-Key: pk_live_xxxxxxxxxxxx X-Api-Secret: sk_live_xxxxxxxxxxxx
HTTP Basic auth is also accepted: Authorization: Basic base64(key:secret). Keys can be scoped (orders:read, orders:write, accounts:read, webhooks:test), restricted to IPs or CIDR ranges, given an expiry, and rotated or revoked at any time.
Live & sandbox
The environment is implied by the key: pk_live_ keys create real orders routed to your UPI accounts; pk_test_ keys create sandbox orders (ids start with TST) whose hosted page lets you simulate paid, failed or expired. Webhooks fire identically in both environments, to endpoints configured for that environment.
Create an order
POST https://repohsc.com/api/v1/orders
Idempotency-Key: inv-1001
{
"amount": 499.00, // required, INR, up to 2 decimals
"client_order_id": "INV-1001", // optional, unique per environment
"payment_account_id": 12, // optional, pins a specific account (live only)
"customer_name": "Asha Rao",
"customer_email": "asha@example.com",
"customer_mobile": "+919999999999",
"customer_ref": "cust_42", // optional, enables sticky rotation
"note": "Order #1001",
"metadata": { "plan": "pro" }, // up to 20 scalar values, echoed back
"redirect_url": "https://shop.example.com/thanks", // host must be allowlisted
"expiry_minutes": 20 // optional, overrides merchant default
}
201 Created
{
"success": true,
"data": {
"id": "ORD7K2M9QX3P1BZ8RT4Y",
"client_order_id": "INV-1001",
"environment": "live",
"status": "pending",
"amount": "499.00",
"currency": "INR",
"payment_url": "https://repohsc.com/pay/ORD7K2M9QX3P1BZ8RT4Y",
"upi_intent": "upi://pay?pa=shop%40okaxis&pn=Shop&am=499.00&cu=INR&tr=ORD7K2…",
"payment_account": { "id": 12, "label": "Primary", "provider": "manual", "upi_id": "shop@okaxis" },
"utr": null, "provider_txn_id": null, "verified_by": null,
"customer": { "name": "Asha Rao", "email": "asha@example.com", "mobile": "+919999999999", "ref": "cust_42" },
"note": "Order #1001", "metadata": { "plan": "pro" },
"redirect_url": "https://shop.example.com/thanks",
"paid_at": null, "expires_at": "2026-11-27T12:45:00+00:00", "cancelled_at": null,
"created_at": "2026-11-27T12:30:00+00:00", "updated_at": "2026-11-27T12:30:00+00:00"
}
}
Order status
| pending | Awaiting payment. Hosted page polls for status. |
| review | Customer submitted a UTR on a manual UPI account; merchant must approve or reject. |
| paid | Verified by provider, approved manually, or confirmed by an administrator. Final. |
| expired | Expiry passed without payment. Final (late provider payments can still recover it within the grace window). |
| cancelled | Cancelled via API or dashboard. Final. |
| failed | Sandbox-only simulated failure. Final. |
Fetch & list
GET https://repohsc.com/api/v1/orders/INV-1001 # by your id GET https://repohsc.com/api/v1/orders/ORD7K2M9QX3P1BZ8RT4Y # by gateway id GET https://repohsc.com/api/v1/orders?status=paid&from=2026-11-01&limit=50&cursor=18231
Lists are newest-first and return pagination.next_cursor; pass it as cursor to fetch the next page.
Account rotation
When rotation is enabled for your merchant account, each live order is routed to one of your eligible UPI accounts according to the chosen strategy. GET /accounts tells you whether it is on and which strategy applies. Eligibility considers active state, health/cooldown, daily and monthly limits, per-transaction bounds and open-order caps.
| round_robin | Round robin. Each new order goes to the next eligible account in turn, giving an even spread of transaction count. |
| weighted | Weighted. Orders are distributed in proportion to each account's weight. Use higher weights for accounts with larger limits. |
| random | Random. Every eligible account has an equal chance on each order. |
| least_used | Least used today. Routes to the account with the most remaining daily limit, keeping balances across accounts level. |
| priority | Priority (failover). Always use the default / lowest-priority-number account; the next one is used only when it hits a limit or is unhealthy. |
Pass payment_account_id to pin an order to a specific account. The gateway never silently substitutes another account for an explicit choice: if that account cannot take the amount you receive a 422. With rotation off, orders go to your default account; if fallback on limit is enabled and the default is full, the next eligible account is used and the order carries rotation_reason: "fallback" in the dashboard.
Hosted checkout
Send customers to payment_url. The page shows a dynamic UPI QR, one-tap buttons for Google Pay, PhonePe, Paytm and BHIM on mobile, polls for status, and on completion redirects to your redirect_url with order_id, client_order_id, status, amount and utr as query parameters. Treat the redirect as a hint only. Confirm payment from the webhook or by fetching the order.
Prefer your own UI? Render upi_intent as a QR or deep link yourself and poll GET /orders/{id}.
Webhooks
Add endpoints per environment in the dashboard and subscribe to events: order.created</code> <code class="kbd">order.paid</code> <code class="kbd">order.expired</code> <code class="kbd">order.cancelled</code> <code class="kbd">order.review_pending</code> <code class="kbd">order.review_rejected</code> <code class="kbd">order.failed. Each endpoint has its own secret. Deliveries retry with backoff (30s → 2m → 10m → 30m → 1h → 2h → 4h) until a 2xx is returned or attempts are exhausted. You can replay any delivery from the dashboard.
POST https://your-server/webhooks/upi
X-Webhook-Event: order.paid
X-Webhook-Event-Id: 2b7f1b2e-…
X-Webhook-Timestamp: 1764246000
X-Webhook-Signature: t=1764246000,v1=5d41402abc4b2a76b9719d911017c592…
Content-Type: application/json
{ "event_id": "2b7f1b2e-…", "event": "order.paid", "created_at": "…", "environment": "live", "data": { …order… } }
Verifying the signature
Compute HMAC-SHA256(secret, "{t}.{raw_body}") and compare with v1 using a constant-time comparison. Reject timestamps older than 5 minutes. Use event_id to de-duplicate: delivery is at-least-once.
// Node.js
const crypto = require("crypto");
function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(",").map(p => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
// PHP
function verify(string $rawBody, string $header, string $secret): bool {
parse_str(str_replace(',', '&', $header), $parts);
if (abs(time() - (int) $parts['t']) > 300) return false;
$expected = hash_hmac('sha256', $parts['t'].'.'.$rawBody, $secret);
return hash_equals($expected, $parts['v1']);
}
WooCommerce & Shopify
WooCommerce: install the UPI Gateway for WooCommerce plugin, enter your gateway URL, API key and secret, add a webhook endpoint pointing at https://your-store/wc-api/upi_gateway, and allowlist your store domain. Orders move to Processing on order.paid with the UTR as transaction id; expiry and cancellation cancel the order; a customer-submitted UTR puts it On hold until you confirm.
Shopify: Shopify checkout only accepts payment providers through an approved Payments App, so the gateway offers a pay-by-link bridge instead. Create a manual payment method named Pay via UPI, create a custom app with read_orders / write_orders, and connect it under Integrations in the dashboard. The gateway subscribes to orders/create, emails the customer a hosted payment link for pending UPI orders, and calls orderMarkAsPaid once the payment is confirmed.
Payment devices (companion app)
For plain UPI-ID accounts there is no status API, so the gateway normally waits for the customer to enter a UTR. Pair the companion mobile app on the phone that receives your bank / UPI credit alerts and those alerts are forwarded to the gateway, matched to the open order with the same amount (and UTR when present) and the order is marked paid automatically, firing order.paid.
Pair devices under Payment devices in the dashboard. Each device gets a bearer token (shown once) and can be bound to one payment account so only that account's orders are considered. Turn off auto-confirm to review matches by hand.
POST https://repohsc.com/api/device/notifications
Authorization: Bearer dev_…
{
"source": "notification", // or "sms"
"app_package": "com.phonepe.app",
"sender": "HDFCBK", // SMS sender id, optional
"title": "Payment received",
"text": "You received Rs. 499.00 from Asha Rao. UPI Ref No 312233445566",
"amount": 499.00, // optional; parsed from text when absent
"utr": "312233445566", // optional; parsed from text when absent
"received_at": "2026-11-27T12:31:05+05:30"
}
202 Accepted
{ "success": true, "data": { "status": "matched", "order_no": "ORD7K2M…", "utr": "312233445566", "match_reason": "single_amount_match" } }
Possible status values: matched, review_only (auto-confirm off), ambiguous (several open orders share the amount; match manually in the dashboard), unmatched, duplicate (UTR already used) and ignored (debit or non-payment text). Batches of up to 50 are accepted as { "notifications": [ … ] }. Also available: GET /api/device/me and POST /api/device/heartbeat.
Idempotency
Send an Idempotency-Key header (≤128 chars) on POST requests. Repeating the same key with the same body within 24 hours replays the original response with Idempotent-Replayed: true. The same key with a different body returns 422 idempotency_conflict; a concurrent duplicate returns 409 request_in_progress.
Errors & rate limits
{ "success": false, "error": { "code": "validation_failed", "message": "…", "details": { "amount": ["…"] } } }
| 401 unauthorized | Missing or invalid key/secret. |
| 403 insufficient_scope · ip_not_allowed · merchant_inactive | Key lacks scope, IP not allowlisted, or merchant suspended. |
| 404 not_found | Unknown order in this environment. |
| 409 request_in_progress | Same Idempotency-Key still processing. |
| 422 validation_failed · idempotency_conflict | Invalid input, limits reached, or key reused with a different body. |
| 429 rate_limited · too_many_attempts | See Retry-After. Defaults: 300/min per key, 1000/min for order creation, 1200/min per IP. |
Every response carries X-Request-Id, X-RateLimit-Limit and X-RateLimit-Remaining.
Endpoint index
/meorders:read or anyIdentify the key, merchant and effective rotation policy.
/accountsaccounts:readList payment accounts with today's usage and the rotation policy. Empty for sandbox keys.
/ordersorders:writeCreate an order. Supports Idempotency-Key.
/ordersorders:readList orders with cursor pagination. Filters: status, client_order_id, customer_ref, from, to, limit, cursor.
/orders/{id}orders:readFetch by gateway id (ORD…/TST…) or your client_order_id. Triggers a provider status check when due.
/orders/{id}/cancelorders:writeCancel a pending or in-review order.
/webhooks/pingwebhooks:testSend a ping event to every active endpoint in this environment.