Inspiration

Someone always covers dinner, and then the hard part starts. Splitting evenly isn't fair, and splitting by item means reading every line, dividing shared plates, working out tax and tip in proportion, and chasing four people for four different amounts. Most people round down and quietly lose money. We wanted the person who paid to get back exactly what they're owed, without doing any arithmetic.

What it does

SplitSense turns one receipt photo and one sentence into exact, itemized PayPal payment requests.

  1. Snap the receipt (photo or PDF) and list who was there.
  2. Say who had what the way you'd text it: "Ada and I split the wings, Tolu had 2 of the 3 beers, we all shared dessert, add 20% tip."
  3. Google Gemini reads the receipt and checks its own math. If the line items don't add up to the subtotal, the exact mismatch is sent back and the model re-reads the receipt.
  4. A second Gemini step matches your sentence to the items, handling "I", "everyone", nicknames, and uneven shares like 2 of 3 beers.
  5. Code, not the model, works out every cent. Tax, tip, fees, and discounts are shared in proportion to what each person ordered, rounded so the shares always add up exactly to the bill.
  6. Review a highlighted receipt. Every line is marked in each friend's color, and you can fix anything with a tap.
  7. Each friend gets a link and pays their exact share through PayPal Smart Payment Buttons (PayPal, Venmo, Pay Later, or card). PayPal's own checkout shows their items line by line.
  8. The host's dashboard updates live. A share shows "Paid" when PayPal captures the money and "Confirmed by PayPal" when PayPal's signed webhook arrives. Hosts can add their PayPal email so each friend’s payment goes straight to them (Orders v2 payee).

How we built it

  • AI: Google Gemini (gemini-3.5-flash) via the @google/genai SDK. Both steps are forced function calls with strict JSON schemas, wrapped in a validate, feedback, retry loop: every answer is checked with Zod and arithmetic, and failures go back to the model so it can correct itself. The same agent also runs on Anthropic Claude by changing one setting.
  • Money math: integer cents and the largest-remainder method, so there are no lost pennies and the same input always gives the same result.
  • PayPal: OAuth 2.0 client credentials with a cached token that refreshes early. Orders v2 create and capture, with items[] and amount.breakdown so the split shows up on PayPal's review page. custom_id maps each order to a friend's share. PayPal-Request-Id makes captures safe to retry. Webhooks are checked with verify-webhook-signature, deduplicated by event ID, and amount-checked before a share is marked paid.
  • App: React 19, Vite, TypeScript, and Tailwind CSS 4 on the front end. Node.js and Express 5 on the back end, with SQLite built into Node. Server-Sent Events push live updates to the dashboard.
  • Quality and hosting: 38 automated tests run offline with fake AI and PayPal clients. Deployed on Render from a Blueprint file.

Challenges we ran into

  • Keeping the AI away from the arithmetic. If a model adds up totals, rounding drifts. We split the job: the model decides who had what, and deterministic code decides how much.
  • Receipts are messy. Blurry digits and add-on lines can make totals not add up. Instead of trusting the first answer, the agent checks items against the subtotal and the parts against the total, then tells the model exactly what's off.
  • PayPal's breakdown rules. An order is rejected unless the items add up exactly to the total. Fractional shares ("half the wings"), proportional tax, and tip all had to become whole-cent line items.
  • Webhook verification. Re-encoding the event can change its bytes, breaking signature checks, so we verify against the raw request body.
  • Real-world setup. Our first AI provider needed prepaid API credits, so we added Gemini behind the same agent interface. A database library wouldn't install on Windows with the latest Node, so we switched to Node's built-in SQLite and removed all native dependencies. We also learned that in the sandbox you can't pay a merchant while logged in as that merchant.

Accomplishments that we're proud of

  • A complete flow on the PayPal Sandbox: receipt photo, AI split, itemized PayPal checkout, captured payment, live dashboard.
  • An AI agent that catches its own arithmetic mistakes before anyone is charged.
  • Shares that always add up to the bill to the cent, backed by tests across hundreds of rounding cases.
  • PayPal's checkout itself shows the AI's split, so the person paying can see exactly what they're paying for.
  • A design built around the receipt: highlighter marks in each friend's color, with shared plates striped in every color.

What we learned

  • AI agents get much more reliable when their mistakes become their next input. Forced function calls plus specific feedback beat longer prompts.
  • In fintech, give the model judgment and give the code arithmetic.
  • PayPal's item breakdown, custom_id and PayPal-Request-Id are what make an AI-generated order auditable and safe to retry.
  • Webhooks are the source of truth. A "success" in the browser is only a hint.

What's next for SplitSense

  • Running tabs for trips and roommates that net out who owes whom across many bills.
  • PayPal Payouts to settle a group pot in one action.
  • Restaurant mode: a QR code on the receipt so the table settles before anyone stands up.
  • Recurring splits for rent and utilities.
  • Multi-currency trips and receipts in any language.

Try it

Live demo: https://splitsense-t08n.onrender.com (click Try the sample receipt). It's on a free server, so the first load can take up to a minute.

Built With

Share this project:

Updates

Submission history