-
-
Backstop: an AI agent drafts the refunds after a cancelled event, and PayPal sandbox money moves only after a person approves.
-
A storm cancels the concert. The organizer owes $876 and has $507.51 in cash, so the red box shows $368.49 short.
-
Each attendee gets a ticket page to take a refund or keep their ticket for the new date.
-
The agent drafts a $480 refund slip for 13 attendees and holds back 4 because the cash isn’t there. Nothing moves until approval.
-
The organizer approves the slip and the refunds go through PayPal. Each has its own request ID, so a retry can’t pay twice.
-
The ledger records every movement of money, with the time, reason, amount and PayPal reference.
-
Asked where attendees stand, the agent adds a live chart to the dashboard.
-
Accept when the attendee is owed the money, contest when they kept a valid ticket. The answer is filed through PayPal Disputes.
Inspiration
A small event organizer sells tickets through PayPal, then spends part of that money on venue and vendor deposits. When a storm cancels the event, everyone wants their money at once, and the cash on hand no longer covers it. One person has to work out who gets paid first while chargebacks start arriving. Refund carelessly and someone gets paid twice. Wait too long and more people go to their card company.
In September 2026, New York sued cancelled-festival promoters, alleging they kept more than $264,000 from ticket buyers and vendors. Eventbrite warns that chargebacks are especially likely when an event is cancelled without a refund or credit.
What it does
Backstop is an AI command center for that morning. A live dashboard shows what is owed, what cash can cover, and how far short the organizer is. An AI agent reads those numbers and drafts refund slips, vendor payments and chargeback answers. Nothing moves until the organizer approves a slip, and every movement of money records its reason.
Attendees get their own ticket page, where they choose a refund or keep their ticket for the new date.
Backstop doesn't fight every chargeback. If an attendee was never refunded, they are owed the money, so it accepts. It contests only when accepting would pay someone twice, or when the attendee kept a valid ticket for the new date.
How I built it
PayPal is the system of record for every dollar on screen:
- Orders v2 sells each ticket as a captured payment.
- Payments v2 issues refunds, with a stable request ID so a retry cannot pay twice.
- Payouts pays vendors.
- Disputes reads chargebacks, submits evidence and accepts claims.
- Webhooks report changes, and each signature is verified with PayPal.
AI: the agent runs on AG Studio's agent harness and calls Groq's gpt-oss-120b, with Gemini as a backup. It reads the numbers, drafts slips with plain reasons, and adds charts to the dashboard when asked.
The agent proposes and the server decides. No agent tool can move money. Cash is reserved when a slip is drafted and rechecked at approval, an open chargeback blocks a refund, and attendees come before vendors while cash is short. The model can't talk its way past those rules.
The app is Next.js and TypeScript on Vercel, with Neon Postgres and 125 unit tests. I used Claude Code as my coding assistant, and APIMatic's ContextMatic plugin to review the PayPal code.
Challenges I ran into
- AG Studio's built-in widget tool reported success on a chart that never rendered, so the agent got its own tool that checks the chart is really on the dashboard before saying so.
- Real testing found that two slips could spend the same cash, so cash is now reserved when a slip is drafted and rechecked at approval.
- A PayPal refund can come back as FAILED or CANCELLED without raising an error. My app counted those as paid until a review caught it.
- Sandbox accounts in some countries can't take cards or send payouts, so the demo runs on a US sandbox business account.
Accomplishments that I'm proud of
- The money is real sandbox money. Every ticket is a captured PayPal payment, and approving a slip sends refunds through PayPal.
- Anyone can try the whole flow on the live site with no login.
- Nobody gets paid twice in the cases I tested. A refund made directly in PayPal is recognised all the way through to the ledger, and a retry reuses the same request ID.
- The agent stays up for free. With Groq's key disabled, Gemini took over a full run and produced the same kinds of slips, a chart and both chargeback answers.
What I learned
- An agent that handles money needs its limits in code, not in its prompt.
- A successful API response doesn't always mean the money moved, so the status has to be read every time.
- The unhappy paths are most of the work. A refund made outside the app, a failed refund and a retry all have to leave the ledger correct.
- Contesting isn't winning. In the sandbox, the cases I resolved in the seller's favor still closed with the attendee paid, so Backstop records that money as gone and never claims a win.
What's next for Backstop
- Organizer accounts, so each organizer connects their own PayPal account and sees only their own event.
- Real attendee messages, so ticket links go out by email and replies come from real people instead of the simulation.
- Better options for attendees held back by a cash shortfall, such as partial refunds now and the rest later.
- A move from the PayPal sandbox to live payments, once contested chargebacks have been tested from start to finish.
Try it
No login is needed. Open the live demo, and find the steps in the README. Attendees are invented, attendee replies are simulated, and all money is PayPal sandbox money.
Built With
- ag-grid
- ag-studio
- apimatic-contextmatic
- claude
- gemini
- gpt-oss-120b
- groq
- neon-postgres
- next.js
- paypal-disputes-api
- paypal-orders-api
- paypal-payments-api
- paypal-payouts-api
- paypal-webhooks
- typescript
- vercel