API Documentation

Create UPI QR codes and verify FamPay payments from your bot or backend. All endpoints return JSON with a status of "success" or "error".

Authentication

Every request needs your API key. Get it from the dashboard. Send it as a header (recommended):

x-api-key: YOUR_API_KEY

or as a query parameter for quick tests: ?key=YOUR_API_KEY

Base URL

Keep your key on your server or bot. Never put it in public website JavaScript. If it leaks, generate a new one from the dashboard.

Live playground

Try the API with your key right here.

Generated QR

POST/api/payment/generate

Creates a UPI QR code for a fixed amount that pays to your account's UPI ID. The QR is valid for 10 minutes.

Body

FieldTypeDescription
amountrequirednumberAmount in ₹, from 1 to 100000

Response

{ "status": "success", "data": { "transaction_id": "TXN-6f1c…", "qr_image": "data:image/png;base64,iVBOR…", "upi_uri": "upi://pay?pa=you@fam&pn=Payment%20User&am=100&cu=INR", "amount": 100, "expires_in_seconds": 600, "created_at": "2026-10-31T10:00:00.000Z" } }

POST/api/payment/verify

Searches your connected Gmail for the payment confirmation email. Waits up to 30 seconds for the email to arrive. Each UTR can be verified only once.

Body

FieldTypeDescription
utrrequiredstring12-digit UTR, or the FamPay transaction ID (FMPIB… or its 10 digits)
transaction_idoptionalstringThe transaction_id from Generate QR. When sent, that QR is marked paid and the paid amount must match the QR amount.

Response

{ "status": "success", "data": { "transaction_id": "TXN-6f1c…", "status": "verified", "utr": "412345678901", "amount": 100, "verified_at": "2026-10-31T10:02:11.000Z" } }
Always send transaction_id when you have it. Without it, any payment email with that UTR is accepted whatever its amount.

GET/api/transaction/:id

Returns one of your transactions by its transaction_id. Use it to check whether a QR has been paid.

GET/api/transactions

Lists your transactions, newest first.

QueryTypeDescription
limitoptionalnumber1–200, default 50

POST/api/invoices

Creates a shareable payment link. Your customer opens it, pays by UPI, enters their UTR, and the invoice turns paid. No code needed on your side, or poll the invoice from your bot.

Body

FieldTypeDescription
amountrequirednumber₹1 to ₹1,00,000 (paise allowed)
descriptionoptionalstringWhat the payment is for, max 200 characters
customer_nameoptionalstringShown on the payment page, max 80 characters
expires_in_daysoptionalnumber1, 7 (default), 30, or 0 for never

Response

{ "status": "success", "data": { "invoice_id": "inv_x7Kp2QaB9mZc", "url": "https://famapp.nobelots.cv/pay/inv_x7Kp2QaB9mZc", "amount": 499, "status": "pending", "expires_at": "2026-11-07T10:00:00.000Z" } }

Other invoice endpoints

EndpointDescription
GET /api/invoicesYour invoices, newest first. ?status=pending|paid|expired|cancelled, ?page=
GET /api/invoices/:idOne invoice: status, paid_amount, utr, paid_at
POST /api/invoices/:id/cancelStop a pending link from accepting payments
The customer must pay at least the invoice amount. A larger payment is accepted and recorded as paid_amount.

Gmail connection

Payments are verified from the Gmail inbox that receives your FamPay emails. Connect it once from the dashboard, or through the API. There are two ways: a Gmail App Password (needs 2-Step Verification, works for any account) or Google sign-in.

EndpointDescription
POST /api/gmail/app-passwordBody {"email": "you@gmail.com", "app_password": "abcd efgh ijkl mnop"}. We test the login first, then store the password encrypted.
GET /api/gmail/connectReturns auth_url, the Google sign-in page. Add ?redirect=true to be redirected straight there.
GET /api/gmail/statusconnected, method (imap or oauth) and the linked email
DELETE /api/gmail/disconnectUnlinks Gmail from your account

Errors

Errors return {"status": "error", "code": "…", "message": "…"}.

CodeHTTPMeaning
MISSING_API_KEY401No API key sent
INVALID_API_KEY401Key is wrong or was replaced
INVALID_AMOUNT400Amount missing or ≤ 0
PAYMENT_NOT_FOUND404No matching payment email within 30 seconds
ALREADY_VERIFIED409This UTR or QR was already verified
AMOUNT_MISMATCH400Paid amount differs from the QR amount
TRANSACTION_EXPIRED410QR is older than 10 minutes
GMAIL_NOT_CONNECTED503Connect Gmail first
GMAIL_AUTH_EXPIRED503Gmail access expired or the App Password was revoked, reconnect it
IMAP_AUTH_FAILED400Gmail rejected the App Password
(rate limit)429Too many requests, slow down