Inspiration
Every budgeting app tells you that you overspent after the money is gone. Freelancers and small online sellers run their whole business through PayPal: client payments come in, and contractors, ads, suppliers, subscriptions and the odd late-night impulse buy go out. We wanted something that steps in at the one moment that matters: just before a payment leaves the account.
What it does
- 🛡️ Pre-payment guard: every outgoing payment is checked against your budgets and habits before PayPal is called. The result is CLEARED, HOLD ("wait 24 hours, then decide", or "pay anyway") or STOPPED (an override needs a written reason). It catches budget overruns, payments far above your usual size, duplicates, large payments to first-time payees (a classic scam pattern), late-night impulse buys and negative monthly cash flow.
- 📥 Your PayPal month in one place: money in and out, PayPal fees, refunds and withdrawals, read from the PayPal Transaction Search API.
- 💵 "Safe to spend today": one number to act on, worked out from your monthly budget and the days left.
- 🏷️ AI categorization: every transaction gets a category, a clean merchant name and a subscription flag. Fix one with a tap and SpendGuard remembers it.
- 💬 Ask your PayPal: plain-English questions like "Can I afford a $300 phone?", answered with exact numbers.
- ✨ AI insights: spending spikes compared with the same days last month, forgotten subscriptions, unusual payments, fee drag and budget pace.
- 🎯 Budgets and alerts: each budget either alerts you or blocks payments that would go over.
- 🔑 Bring your own keys: anyone can add their own PayPal sandbox keys and any AI key (Claude, OpenAI, Gemini, Groq, OpenRouter, DeepSeek, Mistral or any OpenAI-compatible API). Keys are checked with a live call, then stored privately for that browser only.
How we built it
- PayPal: OAuth client credentials. Transaction Search (
/v1/reporting/transactions) reads up to 31 days per request with paging, maps event codes to payment types and extracts fees. Payouts (/v1/payments/payouts) uses idempotency keys and is called only after the guard approves. In demo mode, the app shows the exact Payouts request it would send. - AI (any provider): one AI layer supports Anthropic's API and any OpenAI-compatible API. It gets structured output by forcing a tool call against a JSON schema, and runs a tool-calling agent loop for "Ask your PayPal" with code-backed tools:
summarize,find_transactions,budgets,subscriptions,can_i_afford. Our demo runs on Groq's free tier. - AI explains, code decides: all money maths and every allow/warn/block decision is plain, testable code. The AI never invents numbers and can't be talked into approving a payment, and the server re-checks the rules at the moment of payment.
- Front end: a phone-first web app you can install, with AG Grid for the transaction table and a design built around a payment slip with a rubber stamp. Back end: Node.js and Express, with a private session per browser.
- Safety: rate limits, a daily AI usage cap on the server's own key, user text escaped before display, and keys never sent back to the browser.
Challenges we ran into
- New sandbox accounts have almost no history, so we built a realistic three-month sample-data generator that's clearly labelled and mixes with real sandbox data.
- Transaction Search allows only 31 days per request and can lag behind new activity, so SpendGuard also keeps its own record of the payouts it sends.
- Making AI numbers trustworthy across very different AI providers: we moved every calculation into tools, so the model only reasons and writes.
Accomplishments that we're proud of
- A guard that actually changes behaviour: the $120 late-night shoe purchase gets stopped, with the before-and-after budget shown on the ticket.
- A guard you can't talk your way past, because the decision is made by code and the AI only writes the explanation.
- It works with any AI provider, including free ones, so anyone can run it at no cost.
What we learned
Agentic commerce needs guardrails as a product feature, not just a safety layer. People want an assistant that says "maybe not today" at the right moment, and explains why.
What's next for SpendGuard
- Log in with PayPal for personal accounts, plus webhooks for real-time alerts.
- Team budgets, where an employee's payment request needs the owner's approval.
- The same rules engine in front of PayPal Checkout and Venmo payments.
Built With
- ag-grid
- ai
- express.js
- groq
- node.js
- paypal
- paypal-payouts
- paypal-transaction-search