💡 Inspiration
Every group dinner ends the same way: one person pays the restaurant bill to save time, then spends the next twenty minutes squinting at a paper receipt doing calculator math for the friend who did not have the paneer starters, adding five percent tax proportionally, and chasing people across group chats to get paid back.
Even worse, if you ask an LLM to split a bill directly, LLMs often hallucinate arithmetic or lose cents to rounding—creating a real financial trust problem when real money is on the line.
We built SplitPal around one idea: AI reads; deterministic code does the money math; PayPal settles the money.
⚡ What It Does
SplitPal takes a group bill in any format and turns it into cent-verified individual PayPal checkouts in seconds:
Multimodal Bill Input (Text + Receipt Vision + Real-Time Voice)
- 📷 Scan Receipt Photo: Upload a photo of a physical restaurant receipt (or test instantly with our one-click Sample Receipt generator) alongside exceptions like "People: Yethies, Ravi, Anu. Ravi did not have starters."
- 🎙️ Speak Bill: Speak naturally into your phone or laptop mic and watch your bill transcribe into structured shares.
- 📝 Messy Text: Paste any group note with item prices, taxes, and who shared what.
Transparent Itemized Breakdown ("Why Am I Paying This?")
- Every participant sees their exact itemized breakdown—which dishes they shared, the fraction (
1/3,1/2), their exact tax share, and an explicit🚫 Excludedbadge confirming they were not charged for items they skipped.
- Every participant sees their exact itemized breakdown—which dishes they shared, the fraction (
Zero-Hallucination Money Math (
Decimal+ Largest-Remainder Method)- Gemini AI extracts structured JSON (
people,items,shared_by,tax_percent), and our Python validation engine (validate_split&calculate_shares) recomputes every share usingDecimalarithmetic and the largest-remainder method, guaranteeing that individual shares always sum to the exact cent of the total bill before any PayPal order can be created.
- Gemini AI extracts structured JSON (
Instant PayPal Orders v2 Settlement, QR Codes & Live Sync
- Choose who covered the restaurant bill (
Covered Bill). - Share each friend's personal checkout page via 1-click WhatsApp (pre-filled with their itemized breakdown), Copy Link, or an inline Show/Hide QR Code.
- Friends pay securely via PayPal Checkout (Orders v2 API). Our server verifies the captured USD amount and currency, displays the
✓ PayPal Ref #<Capture_ID>receipt badge, syncs the host dashboard live every three seconds, and triggers a confetti celebration the moment the entire table is settled!
- Choose who covered the restaurant bill (
🛠️ How We Built It
- Backend (
Python/Flask/Gunicorn): Handles AI orchestration, deterministicDecimalmoney validation, thread-safe split state, and server-to-server PayPal OAuth 2.0 + Orders v2 API calls (/create-orderand/capture-order/<order_id>). - AI Layer (
Google Gemini API): Usesgemini-3.5-flash-liteandgemini-3.8-flashwith strictresponseSchemaJSON output to parse unstructured text, receipt photos (inlineDataJPEG compressed client-side on HTML5<canvas>), and spoken audio. - Payments (
PayPal JavaScript SDK+PayPal REST Orders v2 API): Each friend's share generates a PayPal order whosepurchase_unitsdescription includes their itemized dishes. Server-side capture strictly validatesstatus == "COMPLETED",currency_code == "USD", andDecimal(captured_value) == Decimal(person_share). - Frontend (
HTML5/CSS3/Vanilla JS): Built a custom Liquid Bubble Glassmorphic UI that uses rim lighting, customBigNoodleTitlingtext style, Dark and Light mode, Web Speech API plusMediaRecorderfallback for mobile, andcanvas-confettifor celebration. - Cloud Hosting (
Render): Set up on Render withrender.yamlandgunicorn --workers 1 --threads 8to give simultaneous real-time status checks on mobile phones.
🚧 Challenges We Ran Into
- Preventing AI Math Hallucinations: Small and quick LLMs work well to find out who ordered what, but sometimes they miscalculate tax or lose a cent when splitting
$3.50into three parts ($1.16 × 3 = $3.48). We fixed this for good by separating the extraction step from the math: Gemini only findsitemsandshared_by, and Python’scalculate_shares()usesDecimaland the largest-remainder rule to make sure every cent matches. - Cross-Border PayPal Sandbox Restrictions: Default sandbox accounts outside the US caused the system to reject repeated USD test payments due to regional rules. We found that the currency restriction was the cause and set up separate US Sandbox Business (merchant) and Personal (buyer) accounts so that friends can settle reliably.
- Mobile Chrome Voice Permissions & Receipt Upload Speed: Big camera photos from phones (5–8 MB) and sudden restarts of
webkitSpeechRecognitionon Android Chrome caused timeouts or permission problems. We added client-side<canvas>JPEG compression that shrinks files to ~40 KB, and we used a smoothgetUserMedia+MediaRecorderfallback so that mobile browsers always ask for microphone access without error.
🏆 Accomplishments That We're Proud Of
- 100% Cent-Accurate Guarantee: No single cent is ever lost or overcharged—checked by our automatic test suite (
test_features.py). - End-to-End Real-Time Multi-Device Flow: Watching a friend scan the QR code on their phone, finish PayPal checkout, and seeing the host’s screen instantly change to
Paid • PayPal Ref #...with a confetti burst when all friends pay. - Frictionless UX: Friends do not need to download an app or create an account—just tap the WhatsApp link or scan the QR code and pay with PayPal.
📚 What We Learned
- How to mix AI (multimodal text and receipt OCR) with deterministic financial engineering (
Decimalchecks and server-side PayPal capture checks) so that AI features are safe for real-world payments. - Real experience with PayPal Orders v2, OAuth 2.0 token flows, and mobile browser media APIs.
🚀 What's Next for SplitPal
- Persistent Database & Split History: Add PostgreSQL on Render so groups can keep track of trips and monthly roommate costs.
- Multi-Currency & Tip Slider: Allow detection of currency from foreign receipts and an easy tip percentage switch before finalizing shares.
- PayPal Payouts / Venmo Deep Links: Send reimbursements to the payer’s linked PayPal account automatically.