Inspiration

Every group dinner ends the same way. One person puts the whole bill on their card, then spends the next week working out who ordered what and sending "hey, did you get a chance to..." messages. Most bill-splitting apps handle the easy part, dividing by headcount, and leave the awkward part to you.

When I saw this hackathon was about AI and PayPal, I wondered what would happen if an AI agent handled the conversation but was kept away from the money. That second half ended up being the whole project.

What it does

You upload a photo of the receipt, or use the built-in sample. Gemini reads the items, tax and tip, and you can fix anything it got wrong before moving on. Then you tell the agent, in plain English, who had what, and it comes back with a proposed split.

Nothing is charged at that point. You look over the proposal and approve it, and only then does SplitPilot create a PayPal payment link for each person. Friends pay through PayPal Checkout, and your dashboard updates on its own as payments land. A scheduled job also drafts a friendly reminder for anyone who hasn't paid yet. The drafts aren't sent automatically; you copy or share them yourself.

Everything runs in the PayPal Sandbox, so no real money moves.

How we built it

The front end is React and Vite, deployed on Vercel, with Vercel's Node functions as the API. Supabase holds the data: Postgres, realtime updates, and a private bucket for receipt photos. Gemini does two jobs, turning the receipt photo into structured data and powering the agent through function calling. PayPal Orders v2 handles checkout, and a signature-verified webhook confirms each payment.

The part I care about most is how the work is divided. The model only decides who had what. The server does all the money math, with every amount in whole cents. Tax and tip are shared in proportion to what each person ordered, worked out in whole cents and rounded down. Any leftover cents go to the people with the largest fractional remainders, so the shares always add up to the bill exactly, and the leftover cents go to the people with the largest fractional remainders. That way the shares always add up to the bill exactly.

Reminders run from a Cloudflare Worker on a 15-minute schedule, because Vercel's free plan only allows daily cron jobs. The map uses OpenStreetMap through Leaflet, and Framer Motion handles the animations. There's also a Grok fallback in the code that I left switched off for the demo.

Challenges we ran into

Keeping the AI out of the money was harder than it sounds. It's tempting to let the model return amounts directly, so I moved all of that to the server and wrote tests that throw 2,000 random bills at the split function to check the shares always sum to the total.

Payments also arrive twice: once when the buyer's browser finishes checkout, and again from PayPal's webhook. Both have to mark someone as paid without double counting, so they share one function where only the first caller wins.

Smaller problems: the approve button had to be safe against double clicks, Vercel's free cron limit sent me to Cloudflare, and Gemini model names change often enough that I put the model ID in an environment variable instead of hardcoding it.

Accomplishments that we're proud of

  • A real sandbox payment flips the owner's dashboard to Paid without a refresh.
  • The approval step is tested live, and the AI has no way to create a payment request by itself.
  • The scheduled worker has run in production and produced reminder drafts.
  • The split math has automated tests, so the totals don't depend on anyone's mental arithmetic.

What we learned

Let the model handle the part it's good at, which is understanding messy human language, and keep everything that has a single right answer in ordinary code. Payments turned out to be mostly about being careful with retries and duplicates. And free-tier limits shape your architecture more than I expected.

What's next for SplitPilot

Right now sandbox payments land in the app's business account, so the first step is PayPal Payouts, so the money goes to the person who paid the bill. After that I'd add real accounts so owners only see their own splits, rate limits on the AI endpoints, and actually sending reminders (with the owner's OK) instead of just drafting them. Multi-currency receipts would be nice too.

Built With

Share this project:

Updates

Submission history