-
-
Dispute Copilot: AI that answers PayPal disputes, with proof for every sentence.
-
Every dispute in one inbox, with reply-by deadlines, filters, totals and export.
-
How much money is at stake, by deadline and by dispute reason.
-
The AI's reply, where every sentence links to the PayPal evidence that proves it.
-
A short note to the buyer with their tracking number, checked before it's sent.
-
The Verifier removes a sentence that says more than the evidence proves.
-
No proof? It says so and offers a fair refund instead of arguing.
Inspiration
If you've ever sold anything online, you know the feeling: an email from PayPal saying a buyer opened a dispute, and a deadline to respond. The proof you need is usually there somewhere (the payment, the order, the tracking number), but it's spread across three different screens. Small sellers are busy, so they reply in a rush, reply angrily, or don't reply at all. And they lose cases they should have won.
It happens a lot. Merchants accept about 46% of card chargebacks without even fighting, and win only about one in five of the ones they do fight (Mastercard's 2025 State of Chargebacks, via Chargeback Gurus).
AI seemed like the obvious answer, but it worried me. A dispute reply is a statement to PayPal. If a model invents a single sentence, say "the item was delivered" when it was only shipped, the seller can lose the case or mislead the reviewer. So I set myself one rule: the AI may only say what PayPal's own records can prove.
What it does
Dispute Copilot is an inbox for a seller's PayPal disputes. When you open a case, it pulls everything PayPal knows (the payment, the items, Seller Protection status, shipment tracking) and turns it into short numbered facts. The buyer's message becomes numbered claims to answer, never to use as proof.
Before any AI runs, plain code tells you where you stand: "PayPal asks for proof of shipping, and you have USPS tracking 9400… Tracking shows it shipped, not yet delivered."
Then two agents get to work, and you can watch them. A Writer drafts a calm reply where every sentence cites the facts it relies on. A Verifier checks each sentence against only the evidence it cites. If a sentence says more than its proof, it goes back for one rewrite, and if it still isn't proven, it's removed and you see why. Point at any sentence and its evidence lights up beside it. Nothing goes to PayPal until you approve it, and only the verified text can be sent.
Each case also has two conversations, like a messaging app, built from PayPal's records: one with PayPal (what it asked for, what you sent, what it decided) and one with the buyer. Often the buyer just wants to know where their parcel is, so the Writer can draft a short, friendly note with the tracking number, checked by the same Verifier.
The part I like most is that it knows when not to fight. If you have no tracking for an "item not received" case, it won't write a confident argument it can't back up. It tells you plainly and offers a fair way out instead: refund now, or refund after the item is returned. Those notes are fixed text written in code, never AI text, and you confirm each one.
Around all this sits an inbox built around deadlines: every open case shows its reply-by date in your own time zone (amber at 5 days, red at 2), an AG Grid view lets you sort, filter and total your disputes, and an Insights page shows how much money is at stake and which dispute reasons cost you most. Click a bar and you get exactly those cases.
How I built it
The whole design comes down to one idea: facts come from PayPal and code; the AI only writes and checks.
The backend is Python with FastAPI. It reads disputes and tracking through PayPal's Agent Toolkit, and uses PayPal's REST API for the actions the toolkit doesn't cover: sending evidence, messaging the buyer, refunding, and offering a return. Code turns PayPal's JSON into plain-English facts, and even computes comparisons (like "the shipment and the case opening are on the same day") so the Writer can cite them instead of guessing.
The two agents run on Microsoft Agent Framework with gpt-5.4-mini on Microsoft Foundry. The Writer returns structured sentences, each with the facts it cites, so code can check every citation before the Verifier ever sees it. The loop itself (write, check, verify, rewrite once, remove what's unproven) is plain code, so the AI never decides what survives.
The frontend is React and TypeScript. Each agent step streams in live over server-sent events, the inbox is AG Grid and the charts are AG Charts. It's deployed on Render. Because the demo is public, visitors without a PIN see a replay of a real run for free, while judges with the PIN get live AI.
I also cared a lot about quality: 73 unit tests and 44 browser tests run on every push, including automatic WCAG 2.2 AA accessibility checks in light and dark mode. There's also a Postman collection of the whole API.
Challenges I ran into
Creating test disputes was harder than expected. PayPal's sandbox API for opening disputes refused my app, so I ended up opening them by hand, the way a real buyer would, and learned that a new case takes 15–20 minutes before the seller can reply.
The AI was often "right" without being proven. Early drafts said things like "the item shipped before the case was opened". It sounds true, but PayPal's records only have dates, not times. That's exactly why the Verifier exists, and why date comparisons moved into code.
Time zones caught me out. A buyer wrote "I paid on Oct 26", while PayPal records the payment as Oct 27 in UTC. In one run the Writer tried to correct the buyer, and the Verifier stopped it, because the evidence can't prove the buyer wrong.
And one bug cost me an evening: on the hosted app every AI call failed with a vague "Connection error". The cause was an invisible newline at the end of a pasted API key. The app now cleans every setting it reads.
Accomplishments that I'm proud of
It works end to end on real PayPal sandbox cases. I've sent replies with tracking proof, a full refund and a return offer from the app, and PayPal's own records show them. The Verifier catches real mistakes, not staged ones. And when a case can't be won, the app is honest about it instead of pretending.
I'm also proud that it feels like a real product rather than a script: live agent progress, clickable evidence, a full grid inbox, light and dark themes, a phone layout, and accessibility checked on every push.
What I learned
The most useful thing an AI checker can say is "this goes further than the proof." Giving the Verifier only each sentence's own evidence made it much sharper. I also learned to move anything a model could get wrong but code can compute (dates, comparisons, refund notes) into code. And that PayPal's dispute API is rich: what you're allowed to do changes with each case, so the app works best when it only shows what PayPal allows right now.
What's next for Dispute Copilot
Next I'd let sellers edit any sentence themselves, with their edits going through the same Verifier before sending. After that: more dispute types (unauthorized payments, duplicate charges, refunds not processed), richer evidence like carrier delivery confirmations and photos, reminders before deadlines, and finally live PayPal accounts for real sellers.