Kavach Pay
A UPI-style payment app with a fraud shield that speaks up before money leaves.

The problem
Scammers dress up collect requests as refunds, cashback or prizes, so people approve payments that send money out of their account. The warning has to arrive in the ten seconds before the PIN is entered, in the user's own language.
A simulated UPI payment app where every payment and collect request passes through a deterministic risk engine first. When something looks wrong, the user gets a risk score and a plain-language reason in English, Hindi or Bengali.
What it does
- Pay to a UPI ID, request money, and approve or decline collect requests, with balance and history.
- Risk sheet with three outcomes: allow (PIN only), warn (reasons shown, type the amount to continue) and hold (30-minute cooling period).
- Eight rules, from direction mismatch and young payees to mule fan-in and pass-through, scored 0–100 from a single config file.
- “Check a message”: paste an SMS or WhatsApp text, or attach a screenshot, and see what it really asks you to do.
- Analyst dashboard with rule traces, a mule-ring network graph, a hash-chained audit log and an AI copilot limited to read-only tools.
- Double-entry ledger with idempotency keys, a payment state machine, row locking and a CHECK constraint against negative balances.
How it works
- 1
A payment moves through initiated → risk_checked → held or confirmed → settled. Illegal transitions throw.
- 2
Rules R1–R7 compute facts from SQL and memory; R8 adds a capped number of points for validated Gemini scam signals.
- 3
Gemini reads messages and screenshots and rewrites fired rules as a warning in the user's language. Deterministic code decides every ledger entry, balance and final verdict.
Decisions worth noting
The AI decision boundary
The model extracts fields and writes explanations; fixed tables turn those into points. A generated warning is only shown if every number in it appears in the rule facts, otherwise a built-in template is used.
Money that can't drift
A deferred database trigger rejects any transaction whose entries don't sum to zero, and ledger rows can't be updated or deleted.