Skip to content

SR King FamPay Gateway guide

Automatic UPI payment verification in Telegram bots

A Telegram bot verifies a UPI payment automatically by asking the SR King FamPay Gateway confirm link every few seconds after it sends the payment link. The bot learns about the payment even when the customer closes the page or never returns.

Updated

Open my dashboard

See how the code goes into your bot

How the bot learns about a payment

After the customer pays, SR King FamPay Gateway confirms the order. Your bot only has to ask. Each request to the confirm link also looks for the payment, so nothing has to stay open in the customer's browser.

The checking loop in Python

This works with any Telegram library. Run it in a background thread or job so other users are not blocked:

import time, requests

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

def is_paid(order_id, amount):
    r = requests.get(f"{BASE}/api/public/order",
                     params={"code": CODE, "order_id": order_id}, timeout=15)
    data = r.json()
    return data.get("paid") is True and amount <= float(data["amount"]) <= amount + 0.5

def wait_until_paid(order_id, amount, seconds=300):
    end = time.time() + seconds
    while time.time() < end:
        if is_paid(order_id, amount):
            return True
        time.sleep(5)
    return False

When the customer returns

The payment link can bring the customer back to your bot with a t.me link such as https://t.me/YourBotName?start=paid_ORDER1001. Treat that only as a hint and still check the order before you deliver.

Edge cases

  • Two customers pay the same amount at the same moment: automatic matching pauses for them and each customer enters a UTR or Transaction ID.
  • The customer closes the page: the loop still sees the payment.
  • The window ends without a payment: the order shows expired and never creates a second QR.
  • The customer pays twice by mistake: mark the order as delivered in your own database so it is delivered once.

Why not trust the return address alone

Anyone can type a return address by hand. The confirm request is the only proof that the order is really paid.

Questions about this topic

Does my Telegram bot need a webhook?

No. Polling the confirm link every 5 seconds works for a normal bot.

How long should the bot keep checking?

Up to 5 minutes, which is the length of the payment window.

Can a bot verify a payment if the customer never returns?

Yes. The bot asks the confirm link by itself, so the customer does not have to return.

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

टेलीग्राम बॉट में UPI पेमेंट अपने-आप verify करने के लिए बॉट पेमेंट लिंक भेजने के बाद हर 5 सेकंड में confirm लिंक से पूछता है। ग्राहक पेज बंद कर दे या लौटकर न भी आए, तब भी बॉट को पता चल जाता है।