One API fortaking paymentsand paying out.
Terralead speaks plain REST and JSON. Amounts are in paise, every request carries your own reference, and test keys let you try everything before real money moves.
Test keys work from the first day. Live keys work once live payments are on for your account.
- →POST/v1/orders201order made
- →GET/v1/orders/INV-1042200PENDING
- ←POST/webhooks/paymentsorder.success
- →GET/v1/orders/INV-1042200SUCCESS
https://paymenthub.terra-lead.co
From order to paid in four steps
The same four steps work for every order, whichever way your customer pays.
Create an order
Your server sends the amount in paise and your ownreference. If a request times out, send it again: the same reference and amount give you the same order back, never a second one.Create an order 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" }'
Send your customer to pay
Openpay_url, the hosted pay page that works for every order. When the order'scheckoutisH2H, you can put itsupi_intentbehind a button or a QR code in your own page instead.What comes back HTTP/1.1 201 Created { "id": "ord_8m2k4q7x9c1v3b5n6z0w2e4r", "reference": "INV-1042", "status": "PENDING", "amount": 49900, "checkout": "H2H", "pay_url": "https://paymenthub.terra-lead.co/pay/ord_8m2k4q7x9c1v3b5n6z0w2e4r", "upi_intent": "upi://pay?pa=yourshop@bank&pn=Your%20Sho…" }Then// Send the customer to order.pay_url (or show order.upi_intent in your own page).Hear when it is paid
Each webhook is signed with your secret. CheckWebhook-Signatureagainst the raw body, skip aWebhook-Idyou have already handled, then mark your order paid.Webhook to your server POST /webhooks/payments Webhook-Id: evt_4h7k2m9p3q8r1s6t5v0w2x4y Webhook-Event: order.success Webhook-Signature: t=<unix seconds>,v1=<hex HMAC> { "type": "order.success", "data": { "reference": "INV-1042", "status": "SUCCESS", "amount_paid": 49900, "utr": "429817365012" } }Check the signatureconst expected = crypto .createHmac("sha256", secret) .update(`${t}.`) .update(rawBody) // the body exactly as received .digest("hex"); // Equal to v1? Skip a Webhook-Id you have already handled.
Try it all in test mode
sk_test_…keys make test orders, and no money moves. Their pay page has Simulate success and Simulate failure buttons that settle the order the way a real payment would, webhook included.Your keys # Test orders: no money moves Authorization: Bearer sk_test_… # Live orders, once live payments are on Authorization: Bearer sk_live_…
Test payment. No real money moves.Pay Your Shop₹499.00Simulate successSimulate failure
What to know before you start
The questions developers ask us first. The API guide has every field, status and error.
- Base URL
https://paymenthub.terra-lead.co. Test and live requests go to the same address; the key decides which.- Keys
Authorization: Bearer sk_test_…. Make keys in your dashboard's developer settings. Each is shown once: keep it on your server, never in an app or a web page.- Amounts
- Whole paise in JSON: ₹499.00 is
49900. - Safe retries
- The same reference and amount answer
200with the same order. The same reference with another amount is refused withREFERENCE_REUSED. - Webhooks
- Signed with your secret. Answer with any
2xxwithin 10 seconds; anything else is tried again after 1 min, 5 min, 15 min, 1 h, 6 h, 24 h, 7 attempts in all. - Late payments
SUCCESSis final. Money that arrives late can still turn aFAILEDorEXPIREDorderSUCCESS, and you getorder.successthen.- Payouts
- Add a beneficiary with
POST /v1/beneficiaries, then pay it withPOST /v1/payouts. A webhook says when the money has arrived.
Questions about your integration?
Write to us with what you are building. We will set up your account and test keys so you can start in test mode.