REST · JSON

API Documentation

Create an order, show the QR, get the result by webhook or status check.

Quick startCreateVerifyWebhookCodeTry live

Quick start

1
Connect an app and copy its API key.
2
Create an order and show qr_url or send the customer to payment_url.
3
Deliver only after status is paid.

Base URL: https://gateway.adminshops.com

Send the key in the X-API-Key header, only from your server or bot. The key selects the connected app.

POST /api/order

{"amount": 100, "ref": "INV-1042"}
Response
{
  "order_id": "OD4F9A0C2B7E1D3A5C6B8F",
  "status": "pending",
  "gateway": "paytm",
  "amount": "100.00",
  "pay_amount": "100.00",
  "qr_url": "https://gateway.adminshops.com/qr/OD4F....png",
  "payment_url": "https://gateway.adminshops.com/p/OD4F....",
  "upi_link": "upi://pay?...",
  "ref": "INV-1042",
  "utr": null,
  "expires_in": 900
}

Always show pay_amount. On FamPay it includes a few extra paise used for matching.

GET /api/order/<order_id>

status: pending, paid or expired. Check every 5 seconds.

GET /api/orders?limit=20

GET /api/ping

HTTPMeaning
400Invalid amount
401Invalid API key
402Plan expired
403Account suspended
404Order not found
429Too many pending orders
503Gateway not configured

Webhook

Set your URL on the Webhook page. We POST this on payment; reply with HTTP 2xx or we retry. The same order can arrive more than once, so deliver only once per order_id.

{"event":"payment.paid","order_id":"OD4F...","status":"paid","gateway":"paytm",
 "pay_amount":"100.00","amount":"100.00","ref":"INV-1042","utr":"4123...",...}
Verify in Python (Flask)
import hmac, hashlib, time
SECRET = "whsec_..."

@app.post("/payment-hook")
def hook():
    ts = request.headers.get("X-Timestamp", "0")
    good = hmac.new(SECRET.encode(), ts.encode() + b"." + request.get_data(), hashlib.sha256).hexdigest()
    if not hmac.compare_digest(good, request.headers.get("X-Signature", "")) or abs(time.time() - int(ts)) > 300:
        return "bad signature", 401
    data = request.get_json()
    if data["event"] == "payment.paid":
        deliver_once(data["order_id"], data["ref"])
    return "ok"

cURL

curl -X POST https://gateway.adminshops.com/api/order -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" -d '{"amount":100}'

Telegram bot (python-telegram-bot)

import asyncio, httpx
API, H = "https://gateway.adminshops.com", {"X-API-Key": "YOUR_KEY"}

async def buy(update, context):
    async with httpx.AsyncClient(headers=H, timeout=15) as c:
        o = (await c.post(API + "/api/order", json={"amount": 1})).json()
        await update.message.reply_photo(o["qr_url"], caption="Pay Rs " + o["pay_amount"])
        while o["status"] == "pending":
            await asyncio.sleep(5)
            o = (await c.get(API + "/api/order/" + o["order_id"])).json()
    await update.message.reply_text("Payment received" if o["status"] == "paid" else "Order expired")

# app.add_handler(CommandHandler("buy", buy, block=False))

Try it live

This creates a real order on your connected app.

// Response yahan dikhega