Preventing Payment Collisions
How FamGateway uses a 0.01 fractional increment logic to ensure 100% accurate UPI payment matching.
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: Unique Decimal Increments
To completely eliminate collisions, FamGateway enforces a fractional amount rule. When an order is created via the API, the system queries the database for any active, pending orders with the exact same base amount.
How it looks in practice:
- Customer A clicks Checkout. They receive a QR for ₹499.00.
- Customer B clicks Checkout 2 seconds later. They receive a QR for ₹499.01.
- Customer C clicks Checkout 5 seconds later. They receive a QR for ₹499.02.
Because UPI supports transactions down to two decimal places, the user's UPI app (PhonePe, GPay) automatically locks in this exact fractional amount when scanning the QR code.
Bulletproof Matching
When the payment succeeds, the FamPay email receipt states exactly how much was received. If the email says "Received ₹499.02", FamGateway's backend immediately maps this to Customer C's pending order, confirming it instantly without any ambiguity.
This simple mathematical incrementation acts as a unique transaction identifier, entirely eliminating the need for banking UTR (Unique Transaction Reference) lookups, keeping the verification fast and entirely serverless.