Preventing Double Payments — The 0.01 Increment Logic
When relying on email notifications for payment verification, a major edge case arises: What happens if two different customers buy a ₹499 product at the exact same time?
If FamGateway only looked for emails stating "Received ₹499", it would be impossible to reliably distinguish which customer actually completed the payment, leading to race conditions and "double payment" conflicts.
The Solution: Order ID Embedding
To completely eliminate collisions, FamGateway enforces a strict 1:1 mapping using the UPI tn (Transaction Note) parameter. When an order is created via the API, the system embeds a unique, cryptographic Order ID directly into the payment link's purpose note.
How it looks in practice:
- Customer A clicks Checkout. They receive a QR linked to Order fg_A1B2C3D4.
- Customer B clicks Checkout 2 seconds later. They receive a QR linked to Order fg_X9Y8Z7W6.
- Customer C clicks Checkout 5 seconds later. They receive a QR linked to Order fg_L5M4N3P2.
Because every single payment intent has a uniquely generated Order ID firmly attached to its purpose note, it is impossible for transactions to collide, even if the price is identical.
Bulletproof Matching
When the payment succeeds, the FamPay email receipt explicitly states the purpose string. FamGateway's backend daemon parses the text "Purpose : Payment for Order fg_X9Y8Z7W6", extracts the exact Order ID, and instantly maps it to Customer B's pending order.
This explicit identifier mapping guarantees that payments are fulfilled with 100% precision, completely eliminating the need for banking UTR lookups or adjusting the customer's payable amount.