Money is an integer
Amounts are stored as a Money value class holding integer paise, so balances and settlements never suffer floating-point rounding.
A phone-first, offline-first ledger concept for small shopkeepers, connecting voice credit, payment evidence, OCR and intelligent reconciliation.
PakkaKhata is an Android app for shopkeepers who sell on credit (udhaar). A credit can be entered by voice or by hand. When the customer pays later, the shopkeeper photographs the UPI payment, on-device OCR reads it, and a local reconciliation engine decides which open credit it belongs to.
The outcome is shown as fully settled, partially settled, overpaid or no match. The core workflow needs no backend and no external AI API at runtime. It was built for the iQOO Hackathon 2026 (Hyderabad City Battle).
This project taught me that a finance feature has to be predictable and explainable first, and clever second.
Amounts are stored as a Money value class holding integer paise, so balances and settlements never suffer floating-point rounding.
Matching is a hand-written weighted score (name similarity 0.65, amount fit 0.30, timing 0.05) with an identity guardrail, so a payment cannot be strongly matched on amount alone. The review screen shows the reasons behind a match.
Ambiguous evidence should never silently settle against the wrong customer. Matches are tiered into auto match, suggested match and no match, with a confirmation step before the ledger changes.
Settling a payment updates the evidence, the obligation’s remaining amount and status, the reconciliation record and the customer’s balance inside one Room transaction, so a failure cannot leave the ledger half-updated.
Room is the source of truth and the core flow has no network dependency.
ML Kit reads the screenshot, then a parser extracts amount, payer, UPI ID, UTR, date and payment app, tolerating OCR noise.
Name normalization and fuzzy matching bridge the gap between the name on the credit and the payer name on the payment.
Payment evidence is checked for duplicates before reconciliation, to reduce the risk of the same payment being applied twice.
SpeechProvider and OCRProvider interfaces keep platform APIs out of the core business logic.
Code is separated into data, domain and presentation, with ViewModels driving Compose screens.
Where the build pushed back, and what I decided to do about it.
CHALLENGEA credit may say “Ramesh” while the UPI payer name is something else.
DECISIONNormalize and fuzzy-match names, weight identity most heavily, and use a guardrail so a good amount match cannot rescue a weak identity match.
CHALLENGEReal payments rarely equal the credit exactly.
DECISIONA settlement calculator produces fully settled, partially settled or overpaid results and updates the remaining balance.
CHALLENGELayouts differ between UPI apps and OCR text can be messy.
DECISIONThe parser is built around common Indian payment formats, and a review step lets the shopkeeper confirm before anything is saved.
CHALLENGEAndroid’s recognizer prefers offline mode, but availability depends on the device and installed language packs.
DECISIONManual entry is always available as a fallback, and the limitation is stated openly in the README.
Ideas grounded in what the current code and documentation say is missing.
Concise notes on PakkaKhata, written to make the decisions behind it easy to discuss in a review, interview or collaboration.