Inspiration
PayPal already moves money for millions of businesses every day — the hackathon's real question wasn't "can we bolt an AI chatbot onto PayPal checkout," it was "what happens when you let AI actually move the money, not just talk about it?"
We kept coming back to two unglamorous but universal problems every freelancer and small business has: chasing people who owe you money, and figuring out what to do with cash once it finally arrives. Both are naturally a sequence of small decisions — is this client risky? should I offer a discount? how pushy should this reminder be? how much of this payment is actually mine to spend? — which is exactly what an agent is good at. So we built Pocket CFO: an agent that doesn't just flag a risky invoice, it acts on it through real PayPal APIs.
What it does
Pocket CFO watches every open invoice and, on its own:
- Scores payment risk from a client's history and how close the due date is — with a plain-English reason, not a black-box number.
- Negotiates early payment. For large, at-risk invoices with runway before the due date, it offers a capped 2–5% early-payment discount to pull the cash in sooner.
- Escalates reminders through the PayPal Invoicing API — friendly → firm → final — automatically.
- Splits every payment the instant it lands. The moment an invoice is paid, Pocket CFO fires real PayPal Payouts that divide the cash across four pots: Tax Reserve, Reinvestment, Emergency Buffer, and Take-Home. No manual transfers, ever.
Every decision is logged to a live activity feed, so the "why" behind each action is always visible.
How we built it
- Next.js + TypeScript for a single app serving both the dashboard and the agent's API routes.
- PayPal Invoicing + Payouts APIs as the agent's "hands" — every action it decides on becomes a real PayPal call (or a clearly-labeled simulated one if sandbox credentials aren't configured, so the whole product is demoable instantly).
- Claude (Anthropic) as the agent's "voice" — polishing risk rationale and reminder copy into natural language. Crucially, the AI never makes the financial decision itself; a deterministic, testable rules engine does that, and Claude only improves the wording.
- SQLite for zero-setup storage of clients, invoices, pots, and the agent's activity log.
- AG Grid for the invoice ledger and Recharts for the cash-flow projection.
- Vitest for 18 automated tests covering the risk, discount, allocation, and payment-idempotency logic.
Challenges we ran into
- Idempotency. PayPal explicitly documents webhooks as at-least-once delivery — our first pass would have double-credited every pot if a payment event arrived twice. We caught this by actually driving the app end-to-end rather than trusting the code on paper, and added a guard so a duplicate payment event is a safe no-op.
- Discount offers getting clobbered. Early on, an outstanding discount offer was silently overwritten by a plain reminder on the very next agent cycle. We fixed the orchestrator to respect an offer until it actually expires.
- Making it demoable with zero setup. We didn't want judges blocked on creating PayPal sandbox credentials just to see the product work, so every PayPal (and Claude) call has a realistic simulated fallback — the full agent loop runs convincingly out of the box.
Accomplishments we're proud of
A complete, closed-loop product — not a single feature bolted onto checkout. The agent scores, decides, acts, collects, and redistributes, end to end, through real PayPal APIs, with test coverage proving the decision logic actually does what it claims.
What we learned
How deep the PayPal Invoicing and Payouts APIs actually go, and how much more convincing an "AI agent" demo is when the AI is making auditable, deterministic decisions dressed in natural language — rather than an opaque model deciding where money goes.
What's next
Real-time PayPal webhook support in production (beyond the dev "simulate payment" button), configurable pot rules per user, and a richer negotiation flow where the client can accept a discount with one click instead of just replying to an email.
Built With
- ag
- anthropic
- api
- claude
- css
- grid
- invoicing
- javascript
- next.js
- node.js
- payouts
- paypal
- react
- recharts
- rest
- sqlite
- tailwind
- typescript
- vitest
- webhooks
Log in or sign up for Devpost to join the conversation.