Inspiration
In India, group money almost always works the same way. On a Goa trip, one friend books the villa, another pays for cabs, someone covers dinner, and then a week goes by chasing everyone for their share. Flatmates do this with groceries and the electricity bill. Office teams do it with the chai-and-snacks fund that one person always tops up out of their own pocket.
I'd already built SplitChai, a bill-splitter where friends settle their IOUs in USDC on Base. But splitting after the fact still means someone fronts the money. A shared pot fixes the fronting, but joint accounts and shared cards have no rules: anyone can spend anything.
At the same time, AI agents can now pay for things. I kept asking myself: would my friends let an agent touch our trip money? Only if the group, not the model, sets the limits. That question became Chai Pot: a group wallet funded with PayPal, plus an AI agent that pays bills, but only inside rules the members wrote.
What it does
Chai Pot is a shared group wallet with an AI agent that pays the group's bills within limits the members set.
- Create a pot. Add members (by email, or a Base wallet), set each member's contribution, and write the spending policy: per-bill cap, daily cap, allowed categories, and how many approvals from other members a bill above a cap needs (N-of-M).
- Fund it with PayPal. Members pay their share with PayPal Checkout; the server creates and captures the order with the Orders API v2 and records the contribution only from PayPal's capture response. USDC on Base is an optional second route.
- Ask the agent. Type a request like "Pay the $24 dinner at Saravana Bhavan to [email protected]", or snap a receipt. Gemini turns it into structured data: amount, payee, category, who shares it, and its reasoning. Receipts come back itemized with an adjustable split.
- The policy engine decides, not the model. Within every limit → paid right away through PayPal Payouts. Over a cap → held until enough other members approve, then paid with funds, category and payee re-checked. Disallowed category, no valid payee, or not enough money → rejected with the failed check shown.
- Ledger and refunds. Everyone sees what they put in, their share of bills and their balance, and can take unspent money back with a PayPal refund (Payments API v2), capped at their balance.
- Audit log. Every model interpretation (raw JSON), policy decision with each check, approval, payout and refund is logged.
A seeded demo pot ("Goa Trip Pot") lets anyone try it in seconds; everything you do there runs for real against PayPal sandbox and Gemini.
How we built it
- App: Next.js (App Router) + React + TypeScript, mobile-first, on Vercel. Tabs: Pot, Agent, Bills, Audit.
- PayPal (sandbox), all server-side: JS SDK buttons → Orders v2 create/capture (
custom_idties each order to pot and member); Payouts API for agent spending with batch status refresh; Payments API v2 refunds; OAuth client-credentials andPayPal-Request-Ididempotency. Deterministicsender_batch_idper bill means a retry can never pay twice. - AI (Google Gemini):
generateContentwith a strict JSONresponseSchemafor receipt vision and plain-language requests; timeouts, retries and fallback models handle overload; missing info → the agent asks instead of guessing. - Agent loop: interpret (Gemini) → decide (policy engine) → act (Payouts / hold / reject) → audit.
- Policy engine and ledger: pure, deterministic, unit-tested TypeScript. Storage: Upstash Redis.
Safety design. The model only interprets; it can't change limits and is told to ignore instructions that try. Receipt amounts come from the server-stored parse. Nothing is marked paid unless PayPal accepted the payout.
Challenges we ran into
- How much power to give the agent: Gemini interprets, a deterministic engine decides, so a prompt injection in a receipt can't raise a cap.
- Never paying twice: deterministic batch IDs per bill (including pot creation time, since demo resets re-seed bill IDs) plus request-id idempotency.
- What approvals unlock: they lift caps, never hard rules.
- Money correctness: integer minor units, deterministic rounding, refunds capped by balance.
- Model overload: live testing hit Gemini 503s, so calls now time out, retry and fall back.
- A demo judges can use without accounts: seeded pot, "You are …" member switcher, Reset demo.
Accomplishments that we're proud of
- A full agentic commerce loop on PayPal: money in through Checkout, out through agent Payouts, back through refunds, all in one audit log.
- The model never holds the keys; group rules decide every payment.
- Human-in-the-loop only when needed, and receipt photo to payout in a few taps.
What we learned
- Trust in a spending agent comes from legible limits and a clear audit trail, not a smarter model.
- Structured outputs make an LLM a dependable component.
- Idempotency has to be designed in from the first payout.
What's next for Chai Pot
Real identity (Log in with PayPal / magic links), PayPal webhooks, INR pots with live FX, recurring rules for flatmates and office funds, and paying merchants directly through PayPal Checkout.
What changed during the hackathon
Chai Pot grew out of SplitChai (https://splitchai.vercel.app), a bill-splitter started before the hackathon where friends settle debts in USDC on Base. SplitChai had no PayPal integration, no AI, no pooled wallet and no spending rules.
Built new during the submission period: the pot model; the spending policy engine and ledger with tests; PayPal Checkout funding (Orders v2); agent PayPal Payouts; PayPal refunds; the Gemini agent (receipt vision + plain-language requests); approvals and audit log; landing page, demo pot and new mobile UI.
Reused from SplitChai: the wallet setup and its Base settlement contract (0x4ce38dbb7eb76c9f801210dfc27c43bfd009fe15), now only for the optional USDC route, plus store pattern, palette and test harness. Removed: wallet sign-in (SIWE).
Built With
- base
- gemini-api
- google-gemini
- next.js
- node.js
- paypal
- paypal-checkout
- paypal-js-sdk
- paypal-orders-api
- paypal-payments-api
- paypal-payouts
- react
- redis
- typescript
- upstash
- usdc
- vercel
- viem
- wagmi
Log in or sign up for Devpost to join the conversation.