Skip to content

SR King FamPay Gateway guide

Accept automated UPI payments in a Node.js (Telegraf) Telegram bot

Integrate free UPI auto-verification into any Node.js, TypeScript, or Telegraf Telegram bot with zero SDKs. Generate a locked payment link per order and fulfill automatically via signed webhooks or a single fetch() call.

Updated

Open my dashboard

1. Generate a locked payment link in Node.js

Create a unique order_id per purchase and send the link as an inline keyboard button:

const BASE = "https://fampaygateway.lovable.app";
const CODE = "YOURCODE";

export function buildPayLink(amount, orderId, botUsername) {
  const ret = `https://t.me/${botUsername}?start=paid_${orderId}`;
  return `${BASE}/pay/${CODE}/${amount}?order_id=${encodeURIComponent(orderId)}&redirect_url=${ret}`;
}

2. Confirm payment server-side with fetch()

Always verify server-side before delivering access or digital products:

export async function isOrderPaid(orderId, expectedAmount) {
  const res = await fetch(`${BASE}/api/public/order?code=${CODE}&order_id=${encodeURIComponent(orderId)}`);
  const data = await res.json();
  return data.paid === true && Number(data.amount) >= expectedAmount && Number(data.amount) <= expectedAmount + 0.5;
}

3. Prefer webhooks for zero-polling bots

Set your Express/Fastify/Cloudflare Worker endpoint in Dashboard -> Webhooks to receive instant HMAC-SHA256 signed payment.verified POST events the moment a customer pays.

Questions about this topic

Does this work with grammy, node-telegram-bot-api, and Telegraf?

Yes. Because integration uses plain URLs, standard fetch(), and JSON webhooks, it works with every Node.js and TypeScript bot library.

Why check expectedAmount <= amount <= expectedAmount + 0.5?

When two customers pay the same amount simultaneously, the gateway may add a few paise (e.g. ₹199.01) to keep each order uniquely identifiable.

हिंदी में जानकारी

Node.js aur Telegraf Telegram bot mein bina kisi SDK ke free UPI auto-verification jodein — payment link bhejein aur fetch() ya signed webhook se order confirm karein.