Inspiration

Almost every kirana store, medical shop and clothes shop in India still runs on a paper udhaar khata: a notebook of who took goods on credit and who paid back. It's slow to write, easy to lose, and collecting money means awkward reminders and chasing customers for cash. Shopkeepers are busy at the counter and many aren't comfortable typing in English, so most "digital khata" apps never stick.

We wanted a khata the shopkeeper can use by talking to it in Hindi, English or Hinglish, and that helps them actually collect the money, not just record it.

What it does

Kirana Copilot (Hisaab Kitaab) is a voice-first digital udhaar khata for small Indian shops.

  • 🎙️ Speak an entry: "Ramesh ne 500 ka saman liya" or "सुनीता आंटी ने 300 दिए". AI turns it into a ledger entry: customer, amount, credit or payment, items and phone number.
  • 📷 Scan a bill: take a photo of a printed or handwritten parchi. AI reads every line item, and the app adds up the total itself and warns you if it doesn't match the total written on the bill.
  • ✅ Check before saving: the AI only suggests. The shopkeeper sees what was heard, edits anything, then saves.
  • 💸 PayPal payment links: one tap creates a PayPal checkout link for an unpaid entry. When the customer pays, the entry is marked paid automatically (redirect capture, with a verified webhook as backup), and the shop's screen updates live.
  • 💬 Smart WhatsApp reminders: AI writes a reminder whose tone depends on how overdue the udhaar is (friendly → polite → firm), adds the PayPal link, and opens WhatsApp with the message ready to send.
  • 🧾 Itemised bills on WhatsApp after a bill scan, with the customer's total udhaar.
  • ❓ Ask your shop: "Sabse zyada udhaar kiska hai?" gets an answer from your own ledger data.
  • 📊 Dashboard with total due, late payers, today's collection and a 7-day chart.
  • 🏪 Works for kirana, medical and clothes shops. The AI prompts and item suggestions change with the shop type (for example, medicine names are never "corrected").
  • 🌐 Full Hindi / English interface, light and dark mode, and an installable PWA with an offline page and home-screen shortcuts.

How we built it

  • Next.js 16 (App Router) + React 19 + TypeScript. Server Components read the ledger, and Route Handlers serve the API.
  • MongoDB + Mongoose with collections for Shops, Customers, Transactions, Reminders and Sessions. Customers are matched by a lowercase name key, so "ramesh" and "Ramesh" share one khata.
  • Google Gemini handles voice notes and bill photos sent inline. One call does both transcription and extraction, using structured JSON output with a response schema, and every response is validated with Zod before use. A fallback model takes over when the main model is overloaded or its quota is used up.
  • PayPal Orders v2 API: create order → customer approves → capture on return → atomic markPaid. A signature-verified webhook settles payments even if the customer closes the tab. Idempotency keys prevent duplicate orders.
  • WhatsApp via prefilled api.whatsapp.com/send links, so no paid API is needed and the shopkeeper stays in control of what is sent.
  • Phone-number login with httpOnly session cookies. Only a SHA-256 hash of the token is stored.
  • PWA: web manifest, a service worker that caches only build assets (never private khata data), an offline page, and an install prompt.
  • Deployed on Vercel, with a rule-based Hinglish parser so typed entries still work without an AI key.

Challenges we ran into

  • Hindi + Hinglish + English in one sentence. Names spoken in Hindi had to be stored in Roman letters ("रमेश" → "Ramesh") so one person doesn't end up with two khatas.
  • Trusting AI with money. We never let the model decide totals. Bill totals are computed in code from the line items and compared with the printed total, and the shopkeeper confirms every entry.
  • PayPal and INR. PayPal doesn't support domestic INR payments in India, so the demo converts to USD with a configurable rate.
  • Reliable payment confirmation. We handled both the redirect and the webhook without double-marking an entry as paid.
  • Small but painful details: wa.me links corrupting emoji, catching the browser's install event before React loads, and applying cash payments to the oldest udhaar first.

Accomplishments that we're proud of

  • A complete loop: speak → check → save → remind on WhatsApp → get paid on PayPal → khata updates by itself.
  • It works in the shopkeeper's own language, on a phone, as an installable app.

What we learned

  • How to get dependable structured data out of an LLM with response schemas and strict validation.
  • How the PayPal Orders flow, capture and webhooks fit together.
  • That building for real small shops is about trust and simplicity: the human always confirms, and the app never sends anything on its own.

What's next for Kirana Copilot

  • UPI payments alongside PayPal
  • OTP verification for login
  • Offline entry recording that syncs later
  • Scheduled automatic reminders and multi-staff access

Built With

Share this project:

Updates

Submission history