How FamGateway Works — UPI Payment Verification Architecture
FamGateway was built to solve a massive pain point for Indian developers: verifying UPI payments programmatically without registering for expensive, heavyweight banking APIs or corporate merchant accounts. We wanted a system that allowed any developer to start accepting payments in minutes using nothing but their standard FamPay account.
The Core Architecture
Traditional payment gateways connect directly to banking nodal accounts. This requires massive regulatory compliance and long onboarding cycles. FamGateway takes a completely different approach by treating email notifications as the source of truth.
The Step-by-Step Workflow
1. Order Creation
When your user clicks "Checkout", your server sends an API request to FamGateway with your FamPay UPI ID and the exact order amount. FamGateway generates a unique Order ID and embeds it into a UPI QR code's transaction note (the tn parameter).
2. The Customer Pays
Your user scans the QR code using any UPI app (PhonePe, GPay, Paytm) and completes the payment. The money goes directly into your FamPay account. Because the QR code contained the Order ID, the payment app securely attaches this note to the transfer.
3. The Notification
FamPay instantly emails you a receipt containing the exact Order ID in the "Purpose" field. FamGateway's ultra-fast backend daemon connects directly to Gmail via IMAP IDLE, instantly receiving a push notification the millisecond this receipt arrives.
4. Verification & Callback
The daemon parses the email, extracts the Order ID from the Purpose field, and guarantees an exact 1:1 match against the database. It verifies the paid amount, marks the order as success, and immediately fires a webhook to your application.
Why this matters for AI & Developers
By moving the verification layer to email parsing, developers avoid Nodal account setup, KYC delays, and gateway commissions. You get 100% of your funds instantly, while FamGateway handles the programmatic verification. The system is designed to be fully compatible with any LLM code-generation tool.