How to Generate Dynamic FamPay UPI QR Codes with Auto-Verification
Dynamic UPI QR codes are the gold standard for checkout experiences in India. Instead of making customers manually copy your UPI ID and type the exact amount, a dynamic QR code pre-fills everything automatically. In this guide, we'll explain how to generate dynamic FamPay (FamApp) UPI QR codes with real-time automated verification using FamGateway.
Learn how to create dynamic UPI QR codes for your FamPay account with automated verification, locked payable amounts, and instant webhook notifications.
- UPI Specification: Standard NPCI URI schema (
upi://pay?pa=...&am=...&tr=...). - Amount Locking: Customer cannot modify the amount; pre-filled directly into UPI PIN screen.
- Verification Speed: Auto-verified via server IMAP within 3–5 seconds of scan completion.
- API Endpoint:
GET /api/qr.php?api_key=...&amount=...returns SVG/PNG QR image or raw base64 data.
1. Static QR Codes vs Dynamic Auto-Verified QR Codes
Here is why static printed or screenshot QR codes fail in automated web sales compared to dynamic FamGateway QRs:
| Feature Parameter | FamGateway Dynamic QR | Static App Profile QR |
|---|---|---|
| Amount Entry | Locked automatically in app | Manual typing (Dispute prone) |
| Order ID Tagging | Embedded in UPI tr & tn |
None (Manual matching needed) |
| Verification Confirmation | 3–5 Seconds Automated Webhook | Manual screenshot verification |
| Session Expiry (TTL) | 5-Minute Security Window | Permanent (Prone to old receipts) |
2. Why Static QR Codes Hurt Your Sales
If you're displaying a static QR code (like the standard profile QR inside your FamPay app), you are introducing multiple points of friction:
- Amount Entry Errors: Customers frequently type the wrong amount (e.g. ₹499 instead of ₹500), causing payment disputes.
- No Order Link: You cannot match which customer paid for which order without manually requesting transaction IDs and UTR numbers.
- No Real-time Confirmation: Your customer has to wait until you check your app notifications and manually approve their order.
How a Dynamic UPI QR Code Works Under the Hood
Under the NPCI UPI specification, a dynamic QR code is simply a formatted URI string containing specific parameters:
upi://pay?pa=yourvpa@fam&pn=YourBusinessName&am=499.00&tr=ORDER12345&tn=PaymentForOrder&cu=INR
Key UPI String Parameters:
pa(Payee Address): Your FamPay UPI VPA (e.g.,username@fam).pn(Payee Name): The name displayed to the customer on their UPI app screen.am(Amount): The exact payable amount formatted to two decimal places.tr(Transaction Reference): Your unique internal Order ID.tn(Transaction Note): Description of the product or service.cu(Currency): Must always beINR.
Generating Dynamic FamPay QRs with FamGateway API
While constructing a raw UPI string is easy, verifying whether the customer actually completed the payment is the difficult part. FamGateway automates both generation and instant verification.
1. Create an Order via API
Send a quick request from your website backend to FamGateway:
// Generate a dynamic FamPay QR with FamGateway API
$postData = [
'api_key' => 'YOUR_FAMGATEWAY_API_KEY',
'amount' => 199.00,
'order_id' => 'SUB_' . bin2hex(random_bytes(4)),
'redirect_url' => 'https://example.com/thank-you'
];
$ch = curl_init('https://famgateway.in/api/create_order.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = json_decode(curl_exec($ch), true);
// Get the high-resolution QR image URL or direct payment page
$qrImageUrl = $result['qr_image_url'];
$checkoutUrl = $result['payment_url'];
2. Display the QR on Your Custom Checkout
You can embed the generated QR image directly onto your web page, Discord bot embed, or mobile application. Customers can scan the QR code using any UPI application.
3. Automatic Webhook Verification
When the payment hits your FamPay account, FamGateway parses the transaction receipt from your linked email within 3 to 5 seconds and notifies your webhook listener:
// Sample Webhook Handler (webhook.php)
$payload = json_decode(file_get_contents('php://input'), true);
if ($payload['status'] === 'SUCCESS') {
$orderId = $payload['order_id'];
$amount = $payload['amount'];
$utr = $payload['utr'];
// Unlock digital product or activate membership in your database
activateUserOrder($orderId, $utr);
http_response_code(200);
echo json_encode(['status' => 'acknowledged']);
}
Zero-Collision Handling with Bank UTR Idempotency
What if two customers purchase a ₹250 product at the exact same second? FamGateway uses Bank UTR Idempotency Locking combined with atomic database row locks (SELECT ... FOR UPDATE) and strict timestamp filtering. This guarantees 100% collision-free payment attribution for exact clean amounts without requiring decimal increments.
Conclusion
Automated dynamic UPI QR codes transform your checkout into a professional, modern payment experience. With FamGateway, setting up dynamic FamPay QR codes takes less than 5 minutes and costs 0% in transaction fees.
Related Developer Guides & Resources
How FamGateway™ Webhooks Work: Architecture, HMAC-SHA256 Security & Instant Delivery
Deep technical dive into the FamGateway webhook engine: HMAC-SHA256 cryptographic signatures, asynchronous ...
What is FamPay? Complete Guide to FamApp by Trio, UPI & Payments (2026)
Everything you need to know about FamPay (FamApp by Trio) in 2026: What is FamPay, how it works, under 18 a...
How to Contact FamGateway™: Official Customer Support, WhatsApp & Telegram Desk
Get instant official support for FamGateway™. Connect directly with founder Aryan Gupta (@aryanispe) on Wha...