Inspiration

Small businesses lose money at two moments: waiting to get paid, and paying out. 56% of US small businesses are owed money on unpaid invoices, about $17,500 each on average (QuickBooks 2025). Business email compromise cost $3.05B in 2025, 86% of it sent by wire or ACH (FBI IC3 2025). Scammers now send real PayPal invoices with their own phone number in the note, and in 2024 an employee at Arup sent US$25.6M after a deepfake video call with a fake CFO.

The fixes are well known: call back on a number you already have, use two approvers, make new payees wait. Nobody applies them automatically for a five-person studio. That's Finwarden.

What it does

Finwarden is an AI finance team for freelancers and small businesses, built on PayPal, with one trust layer in front of every dollar.

  • Gets you paid (Collections): type "Bill Ali $320 for the logo, due Friday" and the AI drafts the invoice. The client pays through a PayPal Checkout link with PayPal, Pay Later or card, and the invoice is marked paid only when PayPal confirms the capture for the exact amount, never from a "you've been paid" email. Late payers get friendly, firm and final reminders written in their own language.
  • Pays your people (Payables): batch payouts to freelancers, suppliers and staff through PayPal Payouts, each one re-checked moments before it leaves.
  • Stops payment scams (Fraud guard): nine explainable rules hold risky payments:
    • changed bank or PayPal details (business email compromise)
    • lookalike suppliers ("Acrne Ltd", Cyrillic letters) and lookalike domains
    • duplicate or altered invoices ("INV-1042-A")
    • payments split to stay under the approval limit
    • payroll diversion just before payday
    • brand-new payees
    • pressure, secrecy and impersonation ("the CEO needs this now, keep it quiet")
    • contact details that don't match the ones on file, including real-looking PayPal invoices with a "call to cancel" number
    • unusually large amounts
  • Scam inbox: paste any invoice, money request or payment email, in any language (tested in English, Urdu, Arabic and Spanish), and get a plain-language verdict.
  • Cash flow: a 30-day forecast that warns when money gets tight (e.g. right before payday) and says which late invoices to chase first.
  • Trust layer: the AI can hold a payment but never send money past a red flag. Approvals only happen inside the app with a passkey (fingerprint, face or device PIN), cryptographically bound to the exact amount and recipient. $500+ needs two different people. New or changed payees wait 24 hours. "We changed our bank details" never applies from a message: it waits for a callback on the number already on file. Every decision lands in an append-only audit log with a reason anyone can read.

How we built it

Stack: Next.js 16 and TypeScript, Postgres via Drizzle ORM (Neon in production, PGlite locally), SimpleWebAuthn passkeys, AG Grid for the dashboard tables, the Vercel AI SDK, hosted on Vercel.

PayPal (sandbox):

  • OAuth 2.0 client credentials with token caching and retries.
  • Payouts v1 for batch payments. Only one module in the codebase may call it (enforced by a test), it re-checks every payment right before sending, and batches are idempotent.
  • Orders v2 + JS SDK (Checkout) for invoice payment pages with PayPal, Pay Later and card buttons, server-side create and capture.
  • Invoicing v2 client is written too; our sandbox app was still refused the Invoicing permission at submission time, so the demo uses Checkout pay links.

AI:

  • Google Gemini (free tier) and Groq (gpt-oss-120b) through the Vercel AI SDK, with automatic fallback between them.
  • The AI extracts facts, not verdicts: urgency, authority claims, secrecy, off-channel requests, payment-detail changes and the claimed sender, as Zod-validated JSON, in any language. It also turns plain sentences into invoices and writes reminders.
  • Results are cached and calls are capped, and if every model is down the rules keep protecting payments on their own.
  • Claude Code (Anthropic) was used to build the project.

Challenges we ran into

  • PayPal from Pakistan: PayPal accounts can't be opened there, where most of the build happened. We wrote everything against typed PayPal clients with a clearly labelled stub until sandbox access arrived, then had to switch to a US sandbox business account before Payouts would work.
  • Zero budget: everything runs on free tiers with no credit card, so we designed for rate limits: cached AI results, provider fallback, and rules that never depend on the AI being up. Gemini's free tier often answered "high demand", so text tasks now try Groq first.

Accomplishments that we're proud of

  • 48 automated tests, including end-to-end flows on a real Postgres database, and boundary tests that fail the build if AI code is ever imported into the decision layer.
  • On 158 labelled cases in four languages, the very first run, before any tuning, caught 92.9% of held-out scams with a 2.9% false-alarm rate. We report that number rather than the 100% after tuning, because we wrote both the rules and the cases.
  • Real PayPal sandbox payouts and checkout working end to end on a public URL.

What we learned

Ask the AI for facts, not verdicts. Extraction ("does this message claim authority? ask for secrecy?") is reliable and auditable; the decision that moves money belongs in code you can test.

What's next for Finwarden

Self-serve sign-up and one-click "Connect with PayPal", PayPal webhooks and Transaction Search reconciliation, Disputes evidence packs, order-risk scoring at checkout, the PayPal Agent Toolkit, a scam-payee warning network shared across businesses, and PayPal World wallets (UPI, Mercado Pago, Tenpay).

Try it

Live demo: https://finwarden.vercel.app, password finwarden-demo. Sign in as Sara (owner) or Omar (second approver), add a passkey, and use the Demo tab to run "Sara's day". PayPal sandbox only; all people and businesses are fictional.

Built With

Share this project:

Updates

Submission history