Fampay Gateway

Welcome back

Log in to your account to track your payments.

Stays signed in for 2 hoursForgot password?
or

New here? Create a free account

The customer pays. Your site knows in seconds.

Show the QR inside your site or bot. A unique amount matches each payment to its order, with no UTR to type.

Order ORD-1042Paid
₹499.37
Rahul Kumar · via PhonePe
✓Payment email received0.8s
✓Amount matched to order0.9s
✓Webhook delivered to your site1.3s
Fampay Gateway

Reset your password

Enter your account email. We will send a 6 digit code.

Back to log in

Fampay Gateway

Enter your code

Send a new code

Fampay Gateway

Create your account

It's free. Setup takes about 2 minutes.

Step 1 of 3: Account. Next, connect Gmail and get your API key.

Already have an account? Log in

The customer pays. Your site knows in seconds.

Show the QR inside your site or bot. A unique amount matches each payment to its order, with no UTR to type.

Order ORD-1042Paid
₹499.37
Rahul Kumar · via PhonePe
✓Payment email received0.8s
✓Amount matched to order0.9s
✓Webhook delivered to your site1.3s
Dashboard

Good morning

Here is what is happening with your payments today.
Merchant ID -
Total revenue
₹0
Total requests
0
Orders created
Successful
0
Paid orders
Failed or pending
0
Not paid

Activity

Revenue over time
No activity yet
Create your first order to see it here.

Get started

0 of 5

    Order status

    0orders
    PaidWaitingExpired

    Payments by method

    How paid orders were verified

    Live slots

    100 free

    Each dot is one paise slot (0 to 99) that can be added to an amount. Busy slots free up on payment, cancel or timeout.

    Recent transactions

    Your last 5 orders
    OrderAmountPayerUTRStatus

    Transactions

    Every order and its payment status.
    OrderAmountPayerUTRTxn IDStatusTime

    Unmatched payments

    Money that reached your Gmail but did not match any order, for example a wrong amount or a payment after the order expired.
    AmountPayerUTRReceived

    Test payment

    Create a real order and watch it get verified, exactly like your customers will see it. Pay it from any UPI app.

    Create a test order

    Same as expires_in in the API. 2 to 60 minutes, default 5.

    Same order inside a Telegram bot

    No redirect

    The QR comes from the API, so your bot or site shows it itself. Customers never leave your platform.

    QR codePay ₹100.37
    Scan with any UPI app. Expires in 5 minutes.
    No order yetCreate an order to see the QR here.
    AI PROMPTANY LANGUAGEWEBSITE OR BOT

    Add instant payments to any project with AI

    Pick website or bot, download the prompt and paste it into ChatGPT, Claude or Gemini together with your project code. The AI adds instant payments and a full admin panel, so you set the gateway URL, API key, expiry, texts and design from your own admin panel, with nothing to edit in code.

    1Download or copy
    2Paste into your AI with your code
    3Get working payments
    Include my API key in the prompt
    Convenient, but your AI chat then holds a secret. Leave it off and you paste the key into your project's admin panel yourself.

    What the AI will be told

    API key

    One key for your FamPay account. Use it on as many sites, bots and panels as you like.

    Webhooks

    We call your server the moment a payment is verified.

    Endpoint

    -
    Every request is signed with HMAC SHA256 in the X-Fam-Signature header. Verify it on your server.

    Payload

    { "event": "payment.verified", "order_id": "ORD123",
      "status": "paid", "amount": 100.37,
      "utr": "412345678901", "txn_id": "FAM8K2X91Q",
      "payer_name": "RAHUL KUMAR", "received_in": null,
      "reason_code": null, "reason": null }

    Events: payment.verified, payment.unmatched, order.expired. Failed deliveries are retried after 1 min, 5 min, 30 min, 2 hours and 6 hours.

    Recent deliveries

    EventOrderResultAttemptsTime

    Gmail connection

    We read FamPay payment emails from this inbox using IMAP, only while an order is waiting for payment.
    Not connected

    Credentials

    Stored encrypted. We only read emails from FamPay.

    How to get an App Password

    1. Turn on 2-step verification in your Google account.
    2. Open Google Account, search for App passwords.
    3. Create one named after this gateway and copy the 16 letters.
    4. In Gmail settings, make sure IMAP is enabled.

    Connection health

    Last check-
    Last payment email-
    Emails read0
    Orders matched0

    Profile

    Your account details.

    Account

    Change password

    Credits

    -
    Free

    Documentation

    Everything you need to accept UPI payments on any platform.
    API v1

    Quick start

    You can take your first payment in about five minutes. No redirects: your site or bot shows the QR itself.

    1Connect GmailAdd your FamPay Gmail and App Password on the Gmail connection page.
    2Copy your API keyOne key for your FamPay account. Use it on every site, bot and panel.
    3Create an orderCall the API, show the QR, and wait for the webhook.
    Your serverPOST /v1/orders
    GatewayReturns QR and amount
    CustomerScans and pays
    GatewayReads the FamPay email
    Your serverGets the webhook

    Authentication

    Send your API key in the Authorization header of every request. Calls must come from your server or bot, never from browser code, because the key is secret.

    Headers
    Authorization: Bearer fam_7c91e0b4a2d85f3169ab04c7e2d1f58b3a96c0de
    Content-Type: application/json

    Base URL: https://api.yourdomain.com/v1. Your API key works on any platform, with no domain restriction.

    If a key leaks, open API key and press Regenerate key. The old key stops working at once.

    Create an order

    Creates an order and returns a QR code to show to your customer.

    POST/v1/orders

    Body

    FieldTypeDescription
    amountrequirednumberAmount in rupees, for example 100. A few paise (0 to 99) are added so each open order has its own unique amount.
    order_idrequiredstringYour own order reference, up to 64 characters. Reusing it with the same amount returns the same live order, so retries are safe. Once an order is paid, expired or cancelled the id is free again.
    expires_inoptionalnumberSeconds until the order expires. Default 300 (5 minutes), range 120 to 3600. Set it to match your site or bot, for example 900 for 15 minutes.
    webhook_urloptionalstringOverrides your default webhook URL for this order.
    metadataoptionalobjectAnything you want back in the webhook, such as a user ID or chat ID.
    curl https://api.yourdomain.com/v1/orders \
      -H "Authorization: Bearer fam_..." \
      -H "Content-Type: application/json" \
      -d '{ "amount": 100, "order_id": "ORD123" }'
    const res = await fetch("https://api.yourdomain.com/v1/orders", {
      method: "POST",
      headers: { Authorization: "Bearer fam_...", "Content-Type": "application/json" },
      body: JSON.stringify({ amount: 100, order_id: "ORD123" })
    });
    const order = await res.json();   // order.qr_image is ready for an <img>
    import requests
    order = requests.post("https://api.yourdomain.com/v1/orders",
        headers={"Authorization": "Bearer fam_..."},
        json={"amount": 100, "order_id": "ORD123" }).json()
    print(order["qr_png_url"])
    $ch = curl_init("https://api.yourdomain.com/v1/orders");
    curl_setopt_array($ch, [
      CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => ["Authorization: Bearer fam_...", "Content-Type: application/json"],
      CURLOPT_POSTFIELDS => json_encode(["amount" => 100, "order_id" => "ORD123"])
    ]);
    $order = json_decode(curl_exec($ch), true);

    Response

    200 OK
    {
      "id": "ord_8fK2xQ",
      "order_id": "ORD123",
      "status": "pending",
      "base_amount": 100,
      "amount": 100.37,
      "expires_at": "2026-11-06T09:40:00+05:30",
      "qr_image": "data:image/png;base64,iVBOR...",
      "qr_base64": "iVBOR...",
      "qr_png_url": "https://api.yourdomain.com/v1/orders/ord_8fK2xQ/qr.png",
      "upi_link": "upi://pay?pa=rockystore@fam&am=100.37&tn=ORD123"
    }
    Show the exact amount to your customer. The paise are what identify the order. The QR is returned right in the response: use qr_image in an <img> on a website, qr_base64 to upload the picture yourself, or qr_png_url to send it to a bot as a photo. The customer scans it where it is shown and the payment is verified automatically. A QR is only available while the order is waiting for payment.

    Get an order

    Check an order any time. Webhooks are faster, but this is handy for polling.

    GET/v1/orders/{id}
    200 OK, once paid
    {
      "id": "ord_8fK2xQ", "order_id": "ORD123", "status": "paid", "amount": 100.37,
      "payment": {
        "utr": "412345678901", "txn_id": "FAM8K2X91Q",
        "payer_name": "RAHUL KUMAR", "paid_at": "2026-11-06T09:34:12+05:30",
        "received_in": "rockystore@fam"
      }
    }

    Order status

    StatusMeaning
    pendingWaiting for the customer to pay.
    paidPayment found in your Gmail and matched.
    expiredTime ran out. The slot is released.
    cancelledYou cancelled the order.

    Cancel, list and account

    POST/v1/orders/{id}/cancelCancels a pending order and releases its slot. {id} can be the gateway id or your own order_id, here and on GET.
    GET/v1/ordersLists orders. Filters: status, order_id (your own id), created_from, created_to, limit, starting_after.
    GET/v1/orders/{id}/qr.pngThe QR as a PNG image.
    GET/v1/accountFree slots, unmatched payment count and your credit balance.

    Webhooks

    We call your server when something happens to an order. Set the URL on the Webhooks page, or pass webhook_url per order.

    EventSent when
    payment.verifiedA payment is matched to an order.
    order.expiredAn order times out unpaid.
    payment.unmatchedA payment arrives that no order claimed (wrong amount, or after expiry). Attach it on the Unmatched payments page.
    payment.verified
    {
      "event": "payment.verified",
      "order_id": "ORD123",
      "id": "ord_8fK2xQ",
      "status": "paid",
      "amount": 100.37,
      "paid_at": "2026-11-06T09:34:12+05:30",
      "utr": "412345678901",
      "txn_id": "FAM8K2X91Q",
      "payer_name": "RAHUL KUMAR",
      "received_in": "rockystore@fam",
      "metadata": { "chat_id": 99887766 }
    }

    Every webhook also has reason_code and reason (the exact reason when a payment is not accepted). A field that the FamPay email does not contain is sent as null, for example utr on a FamPay to FamPay transfer.

    Verify the signature

    Every request carries X-Fam-Signature (HMAC SHA256 of the raw body). For replay protection also use X-Fam-Timestamp and X-Fam-Signature-V2, the HMAC SHA256 of timestamp + "." + body. Reject requests whose timestamp is more than 5 minutes old.

    import crypto from "crypto";
    const sig = req.headers["x-fam-signature"];
    const expected = crypto.createHmac("sha256", process.env.FAM_WEBHOOK_SECRET)
      .update(req.rawBody).digest("hex");
    if (!crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected))) return res.sendStatus(401);
    res.sendStatus(200);
    import hmac, hashlib
    expected = hmac.new(SECRET.encode(), request.body, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(request.headers["X-Fam-Signature"], expected):
        return HttpResponse(status=401)
    return HttpResponse(status=200)

    Delivery and retries

    • Reply with any 2xx within 10 seconds.
    • If we get anything else, we retry after 1 min, 5 min, 30 min, 2 hours and 6 hours.
    • The same event can arrive twice. Use order_id to ignore repeats.

    Use it in a Telegram bot

    The bot shows the QR inside the chat. The customer never leaves Telegram.

    Python
    order = requests.post(API + "/orders",
        headers={"Authorization": "Bearer " + KEY},
        json={"amount": 100, "order_id": oid, "expires_in": 300,   # 5 minutes, change as you like (120 to 3600)
              "metadata": {"chat_id": chat_id}}).json()
    
    # the QR goes straight into the chat, no link to open
    bot.send_photo(chat_id, order["qr_png_url"],
        caption=f"Scan and pay exactly ₹{order['amount']}. Expires in 5 minutes.")
    # or upload the picture yourself: bot.send_photo(chat_id, base64.b64decode(order["qr_base64"]))
    
    # the customer pays; you get a payment.verified webhook, nothing more to do

    Complete example

    A working flow in four files: create the order, show the exact amount and QR, wait for the webhook, deliver. Copy it, set three environment variables (FAM_BASE_URL, FAM_API_KEY, FAM_WEBHOOK_SECRET) and run it.

    Short on time? Open AI prompt in the menu, download the prompt and paste it into ChatGPT, Claude or Gemini with your own code. It will add this to your project.
    // npm i express   then   node server.js
    const express = require("express"), crypto = require("crypto");
    const API = process.env.FAM_BASE_URL, KEY = process.env.FAM_API_KEY, SECRET = process.env.FAM_WEBHOOK_SECRET;
    const app = express(), orders = new Map();            // use a database in a real project
    const fam = (path, body) => fetch(API + path, {
      method: body ? "POST" : "GET",
      headers: { Authorization: "Bearer " + KEY, "Content-Type": "application/json" },
      body: body && JSON.stringify(body) }).then(r => r.json());
    
    // 1) the page asks us to start a payment
    app.post("/pay", express.json(), async (req, res) => {
      const id = "ORD" + Date.now();
      const o = await fam("/orders", { amount: Number(req.body.amount), order_id: id, expires_in: 300 });
      if (o.error) return res.status(400).json(o.error);
      orders.set(id, { status: "pending", amount: o.amount });
      res.json({ order_id: id, amount: o.amount, qr: o.qr_image, expires_at: o.expires_at });
    });
    // 2) the page polls this every 3 seconds
    app.get("/status/:id", (req, res) => res.json({ status: (orders.get(req.params.id) || {}).status || "unknown" }));
    
    // 3) the gateway tells us the payment is done
    app.post("/webhook", express.raw({ type: "*/*" }), (req, res) => {
      const ts = req.headers["x-fam-timestamp"], sig = req.headers["x-fam-signature-v2"] || "";
      const exp = crypto.createHmac("sha256", SECRET).update(ts + "." + req.body).digest("hex");
      if (Math.abs(Date.now() / 1000 - Number(ts)) > 300 || sig.length !== exp.length ||
          !crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(exp))) return res.sendStatus(401);
      const ev = JSON.parse(req.body);
      const o = orders.get(ev.order_id);
      if (ev.event === "payment.verified" && o && o.status !== "paid") {
        o.status = "paid";            // deliver the product / add balance here
      } else if (ev.event === "order.expired" && o && o.status === "pending") o.status = "expired";
      res.sendStatus(200);
    });
    app.use(express.static("public")); app.listen(3000);
    # pip install flask requests
    import os, hmac, hashlib, time, json, requests
    from flask import Flask, request, jsonify
    API, KEY, SECRET = os.environ["FAM_BASE_URL"], os.environ["FAM_API_KEY"], os.environ["FAM_WEBHOOK_SECRET"]
    H = {"Authorization": "Bearer " + KEY}
    app, orders = Flask(__name__), {}                 # use a database in a real project
    
    @app.post("/pay")
    def pay():
        oid = "ORD%d" % (time.time() * 1000)
        o = requests.post(API + "/orders", headers=H, json={
            "amount": float(request.json["amount"]), "order_id": oid, "expires_in": 300}).json()
        if "error" in o: return jsonify(o["error"]), 400
        orders[oid] = {"status": "pending", "amount": o["amount"]}
        return jsonify(order_id=oid, amount=o["amount"], qr=o["qr_image"], expires_at=o["expires_at"])
    
    @app.get("/status/<oid>")
    def status(oid): return jsonify(status=orders.get(oid, {}).get("status", "unknown"))
    
    @app.post("/webhook")
    def webhook():
        ts, sig = request.headers.get("X-Fam-Timestamp", "0"), request.headers.get("X-Fam-Signature-V2", "")
        exp = hmac.new(SECRET.encode(), ts.encode() + b"." + request.get_data(), hashlib.sha256).hexdigest()
        if abs(time.time() - int(ts)) > 300 or not hmac.compare_digest(sig, exp): return "", 401
        ev = json.loads(request.get_data()); o = orders.get(ev["order_id"])
        if ev["event"] == "payment.verified" and o and o["status"] != "paid":
            o["status"] = "paid"                       # deliver the product / add balance here
        elif ev["event"] == "order.expired" and o and o["status"] == "pending":
            o["status"] = "expired"
        return "", 200
    <?php
    // pay.php : creates the order and returns the QR to your page
    $API = getenv("FAM_BASE_URL"); $KEY = getenv("FAM_API_KEY");
    function fam($path, $body = null) { global $API, $KEY;
      $ch = curl_init($API . $path);
      curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER => ["Authorization: Bearer $KEY", "Content-Type: application/json"]]);
      if ($body) { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); }
      return json_decode(curl_exec($ch), true); }
    
    $oid = "ORD" . round(microtime(true) * 1000);
    $o = fam("/orders", ["amount" => (float)$_POST["amount"], "order_id" => $oid, "expires_in" => 300]);
    if (isset($o["error"])) { http_response_code(400); exit(json_encode($o["error"])); }
    // save $oid, $o["amount"], status "pending" in your database here
    echo json_encode(["order_id" => $oid, "amount" => $o["amount"], "qr" => $o["qr_image"], "expires_at" => $o["expires_at"]]);
    
    // ---- webhook.php ----
    $raw = file_get_contents("php://input");
    $ts = $_SERVER["HTTP_X_FAM_TIMESTAMP"] ?? "0"; $sig = $_SERVER["HTTP_X_FAM_SIGNATURE_V2"] ?? "";
    $exp = hash_hmac("sha256", $ts . "." . $raw, getenv("FAM_WEBHOOK_SECRET"));
    if (abs(time() - (int)$ts) > 300 || !hash_equals($exp, $sig)) { http_response_code(401); exit; }
    $ev = json_decode($raw, true);
    if ($ev["event"] === "payment.verified") {
      // if the order is not marked paid yet: mark it paid and deliver here
    }
    http_response_code(200);
    <!-- public/index.html : the customer page. It only talks to YOUR server, never to the gateway. -->
    <input id="amt" type="number" value="100"> <button onclick="pay()">Pay</button>
    <div id="box" style="display:none">
      <h3>Pay exactly &#8377;<span id="exact"></span></h3>
      <img id="qr" width="260" alt="UPI QR"><p id="msg">Waiting for payment...</p>
    </div>
    <script>
    async function pay() {
      const r = await fetch("/pay", { method: "POST", headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ amount: document.getElementById("amt").value }) });
      const o = await r.json();
      if (o.message) return alert(o.message);
      exact.textContent = o.amount.toFixed(2); qr.src = o.qr; box.style.display = "block";
      const t = setInterval(async () => {
        const s = (await (await fetch("/status/" + o.order_id)).json()).status;
        if (s === "paid") { clearInterval(t); msg.textContent = "Payment received. Thank you!"; }
        if (new Date() > new Date(o.expires_at) || s === "expired") { clearInterval(t); msg.textContent = "Expired. Please try again."; }
      }, 3000);
    }
    </script>
    1. The customer page calls your server. Your server calls the gateway with the secret key.
    2. Show amount exactly as returned (the paise identify the order) and the qr_image.
    3. Deliver only when the signed payment.verified webhook arrives, never because the browser says so.

    Errors and limits

    Errors use standard HTTP codes and a JSON body: { "error": { "code": "...", "message": "..." } }.

    HTTPCodeMeaning
    401invalid_api_keyMissing, wrong or regenerated key.
    400invalid_amountAmount is missing, zero or too large.
    404order_not_foundNo order with this ID in your account.
    409gmail_not_connectedConnect Gmail before creating orders.
    429rate_limitedMore than 120 requests a minute on one key.
    503slots_fullAll 100 unique-amount slots for this amount are busy. Try again shortly or use a shorter expires_in.
    400invalid_order_idorder_id is missing or longer than 64 characters.
    409order_id_conflictThis order_id is live with a different amount. Use a new id.
    402insufficient_creditsCredits are on and your wallet is too low. Ask the admin to add credits.
    403account_suspendedYour account was suspended by the administrator.

    System status

    Live health of everything your payments depend on.
    Checking