# HexPay / HexUPI - UPI payment gateway API (v1) Base URL : https://hexupi.xyz Auth : send your API key in the header x-api-key: YOUR_API_KEY (server-side only, never in a browser/app) Format : JSON over HTTPS. Amounts are INR rupees. ## 1. Create order POST https://hexupi.xyz/api/v1/create-order Body (JSON): amount number required 1 to 100000 order_id string recommended your own unique reference webhook string optional public https URL that receives the payment webhook redirect string optional https page to send the customer to after paying Response: { ok, id ("hex_xxxxx"), order_id, amount, payable (exact amount to pay, may have a few paise added), pay_url (hosted checkout page), upi (upi:// link), qr (data URL image), expires_at (ms), status } Orders expire after 10 minutes. ## 2. Check status GET https://hexupi.xyz/api/v1/status/{id or your order_id} Use the gateway id (hex_xxxxx) or your own order_id (then x-api-key is required). Response: { ok, id, order_id, status: PENDING | PAID | EXPIRED | FAILED, paid: bool, amount, payable, paid_at } ## 3. Webhook (sent when an order is paid) POST to your webhook URL, JSON body: { "event": "payment.success", "id": "hex_xxxxx", "order_id": "ORD-1", "status": "PAID", "amount": 199, "payable": 199.01, "paid_at": 1728189400000 } Headers: x-signature (= lower-case hex HMAC-SHA256 of the RAW request body, key = your API key), Content-Type: application/json Verify the signature against the RAW body (never re-encoded JSON), compare in constant time, then reply HTTP 2xx. Failed deliveries are retried after 1 min, 5 min, 15 min, 1 h, 6 h. Always make your handler idempotent (the same event can arrive twice). ## Errors JSON { "error": "message" } with HTTP 400 (bad input), 401 (bad key), 402 (plan expired), 403 (blocked / gateway not ready), 429 (rate limit), 5xx. ## Full docs https://hexupi.xyz/docs