Inspiration
Last week I opened my payment statement and found two charges of $19.90 from a 3D generation service I had stopped using. It had renewed silently for two months. I never got a reminder, the credits I paid for expired unused, and the next charge landed seconds later. Getting a refund meant digging up invoice IDs, taking screenshots and writing emails back and forth for days.
I realised this was not a one-off. People forget. Subscriptions count on it. I wanted an agent that remembers for me.
What it does
StatPal is an AI agent that watches a PayPal account.
- It notices: new vendors, auto-renewals, unusual spikes and budget overruns.
- It asks: "Is this yours? Do you still want it?" and remembers the answer for every vendor.
- It acts: with one approval, it cancels the PayPal subscription, gathers the evidence and submits a refund request.
- It follows up: the feed shows the status until the refund lands.
Nothing happens without the user's approval.
How I built it
- PayPal sandbox with a test merchant and a test buyer. The merchant side creates a product, a plan and a subscription, so the whole flow runs on real PayPal calls.
- PayPal Agent Toolkit as the agent's tools: transaction search, subscription details and cancellation.
- Claude as the reasoning layer: it decides when to ask, calls the PayPal tools, and writes the refund request from the evidence.
- Next.js, TypeScript, Prisma and SQLite for the app, with plain, unit-tested rules for detection so alerts are predictable.
Challenges
- PayPal's APIs are built for merchants. A buyer cannot issue a refund by API, so StatPal cancels the subscription itself, sends the refund request to the vendor, and tracks the result.
- Cancellation only works for subscriptions billed through PayPal. For other vendors, StatPal still prepares the evidence and the request.
- Deciding what the agent may do alone. I settled on a single rule: it can read anything, but every action needs one clear approval.
What I learned
- An agent is most useful when it does the boring follow-through, not when it only reports.
- Simple rules for detection plus an AI model for judgement and writing works better than asking the model to do everything.
- Trust comes from showing proof: IDs, dates and amounts on every card.
What's next
- Memory of why each purchase was made, with budgets per category.
- Renewal reminders before the charge, not after.
- Finding cheaper alternatives when a subscription no longer fits the budget.
Built With
- anthropic
- claude
- claude-code
- next.js
- node.js
- paypal
- paypal-agent-toolkit
- paypal-sandbox
- paypal-subscriptions
- prisma
- react
- sqlite
- tailwindcss
- typescript