Inspiration

Group expenses, travel bills, and shared subscriptions break down the moment someone disputes an amount, forgets an uncategorized vendor, or wants to pay their share over time. Most split tools leave you stranded in static spreadsheets or plain chat rooms, forcing someone to manually calculate uneven shares and chase down payments on separate payment apps.

We wanted to build PocketMate: an intelligent, conversational financial workspace that pairs the conversational reasoning of Google Gemini with the financial rails of PayPal Developer Platform (Sandbox) and the speed of AG Grid. PocketMate turns chaotic group finances into an automated, penny-locked ledger where bills are analyzed, split, dispatched as real PayPal invoices, and settled in real time.


What it does

  • Conversational Financial Co-Pilot: Chat naturally with Gemini to query transactions, check budgets, audit receipts, or initiate complex differential bill splits.
  • Penny-Locked Differential Splitting: Supports conversational custom allocations
  • Live PayPal Invoicing & Orders v2 Checkout: Generates itemized PayPal Invoices with Sandbox accounts. Payers can settle debts with Pay in Full or Pay in 4 installments via PayPal Checkout, routing funds directly to the organizer.
  • Decline & Negotiation Loop: Debtors can decline an invoice with an optional message (e.g., "I can only pay $150 right now"). The organizer receives an alert with an Ask Again action that re-dispatches an adjusted invoice while preserving the original category metadata.
  • Interactive Triage & Category Inheritance: Categorizes expenses into a 3-scope triage model (This item, This vendor, or All similar), updating budget caps and persisting across chat threads.
  • Multimodal Receipt Audit: Upload a photo of any receipt; Gemini parses the itemized bill, tax, and tip, and flags discrepancies against settled ledger records.
  • Live Financial Ledger (AG Grid): Real-time searchable, filterable grid with status indicators (Paid, Received, To send, To receive).

How we built it

  1. Frontend & UI: Next.js 16 (App Router), React 19, Tailwind CSS v4, AG Grid / AG Studio for the data ledger, and Bryntum Scheduler for subscription timelines.
  2. AI & Agent Architecture: Google Gemini API (@google/genai) using function calling with Zod validation. Gemini parses user intent and parameters while routing mathematical operations to deterministic server-side modules.
  3. PayPal Sandbox Integration:
    • Integrated Log in with PayPal OAuth for identity.
    • Built Invoicing API v2 workflows for bill splits and reminders.
    • Implemented Orders API v2 for direct checkout and capture.
    • Added Partner Referrals v2 for direct merchant payouts.
    • Implemented signed Webhooks (INVOICING.INVOICE.PAID) with SHA-256 signature verification for instant ledger reconciliation.
  4. Database & Persistence: Neon PostgreSQL database managed through Prisma ORM to track user profiles, splits, override rules, and conversation states.

Challenges we ran into

  • Sandbox Account Constraints: PayPal Sandbox does not support consumer-to-consumer PayPal.me or peer-to-peer REST endpoints. We engineered a scalable architecture using Business accounts with Invoicing v2 and Orders v2 direct-payee captures to deliver authentic multi-user payment flows.
  • Deterministic Currency Math vs. LLM Drift: LLMs can easily introduce penny-rounding errors or hallucinate totals. We decoupled reasoning from calculation: Gemini extracts entities and relative constraints, while our backend solver enforces strict penny-locking ($\sum \text{shares} \equiv \text{total}$) before calling PayPal APIs.
  • Real-Time Multi-Window State Synchronization: Ensuring that when Friend B pays an invoice in an incognito window, Organizer A’s dashboard and chat cards instantly reflect Paid / Received without requiring a hard browser refresh.

Accomplishments that we're proud of

  • Achieving end-to-end multi-user settlement that moves simulated money across real PayPal Sandbox accounts with direct invoice creation, webhook capture, and ledger updates.
  • Designing an intuitive negotiation loop (Decline -> Ask Again) that mirrors real-world bill disputes with automatic category inheritance.
  • Delivering a high-performance financial interface that blends conversational AI seamlessly with AG Grid’s real-time transactional grid.

What we learned

  • How to structure production-grade PayPal Invoicing and Orders v2 lifecycles including webhook signature validation.
  • The power of strictly typed tool calling with Google Gemini to guarantee safe, deterministic transactional execution.
  • Best practices for multi-tenant financial data management in modern serverless PostgreSQL architectures.

What's next for PocketMate

  • Support for automated group expense pools and smart recurring escrow via PayPal Subscriptions.
  • Multi-currency split rebalancing with automated foreign exchange estimation.
  • Mobile progressive web app (PWA) with native camera receipt capture and push notifications for invoice events.

Built With

Share this project:

Updates

Submission history