The problem
Every group meal ends with the same small disaster: one receipt, five people, and a ten-minute negotiation over who had the second pizza, whether the tip splits evenly, and why the shares never quite add up to the total. Existing splitters make you type every item by hand — the tedious part is the data entry, and the error-prone part is the arithmetic: tax and tip rarely divide cleanly, and a cent or two always goes missing.
The solution
SplitBill AI removes both halves of the problem:
- AI does the data entry. Paste the receipt text and an LLM (via OpenRouter) extracts every line item, quantity, line total, tax, tip and currency as strict JSON — including per-item assignees when the bill names them ("Dragon Roll (for Ana)" is assigned to Ana automatically). A deterministic built-in parser is the safety net, so extraction still works when free models are rate-limited or no API key is configured — the demo never breaks.
- Exact math does the splitting. A pure-function engine works in integer minor units and distributes remainder cents deterministically (largest remainder). Tax & tip follow each person's item subtotal proportionally. Shares always sum to the bill total — $70.11 split three ways is $23.38 / $23.37 / $23.36, never $70.09.
- PayPal does the settling. Each person's card carries a PayPal checkout for exactly their share, paid to the bill organizer. The server creates and captures orders through the PayPal Sandbox Orders API v2 and the page renders PayPal Smart Buttons (JS SDK). With sandbox app credentials configured, the genuine PayPal Sandbox checkout opens; without them, the app runs a clearly-labelled demo mode through the same create → approve → capture flow, so judges can evaluate the whole product before creating any account.
How it is built
| Piece | Technology | What it does |
|---|---|---|
| Server | Node.js (zero dependencies, built-in http/fetch) |
Serves the app and the JSON APIs |
| Split engine | Pure JS module shared by browser + tests | Integer-minor-unit math, proportional tax/tip, largest-remainder rounding |
| AI extraction | OpenRouter chat completions (free models, chained + 429 retry) | Receipt text → strict JSON (items, tax, tip, currency, assignees) |
| Fallback parser | Deterministic line parser | US + Indonesian number formats; reconciles tax from total − subtotal |
| Payments | PayPal Sandbox — JS SDK Smart Buttons + REST Orders API v2 (OAuth, create, capture) | One order per person, for exactly their share |
All secrets stay server-side: the PayPal client secret is only used in the OAuth call to PayPal, the OpenRouter key only in the Authorization header to OpenRouter; neither is ever sent to the browser or logged. The public surface is one /api/config endpoint (modes + the public client ID), /api/parse, and the two order endpoints.
Why this matters
Splitting a bill is a small, universal, genuinely annoying problem — and it sits exactly at the intersection this hackathon asks about: an AI that understands an unstructured real-world document, and a payment rail that settles the result in one tap. SplitBill AI is a complete product loop — understand, compute, collect — not a chatbot bolted onto a checkout button: remove the AI and the data entry burden returns; remove PayPal and you're back to chasing bank transfers.
Built With
- css
- html
- javascript
- node.js
- openrouter
- paypal