Inspiration
Doctors and lawyers lean on precedent: what happened last time a case looked like this, and what was done about it. Merchants don’t get that. When PayPal disputes spike, the dashboard says the rate went up, but not why or what worked for stores in the same spot, so people refund everyone or file the same evidence on every case. We’d seen what that costs, like claiming “delivered” on a parcel that’s still in a van. We wanted something that works like a good operations consultant: work out what happened, look at what worked before, and let a human decide.
What it does
MediateAI reads a merchant’s PayPal sandbox account, including the disputes, the deadlines, what PayPal lets the seller do right now, and the parcel’s state from PayPal tracking. It finds the cause of a dispute spike, then matches each dispute to similar past cases. Delivered parcels get proof of delivery, parcels still in transit get an honest delivery update that never claims delivery, lost parcels get a refund, and disputes with no tracking wait for a records check. Cases that backfired show up as warnings and never get a vote. A rule-based gate decides what runs automatically, what needs a click and what needs explicit approval, and nothing reaches a buyer or PayPal without one. On approval it re-checks the live dispute and only calls PayPal if the action is allowed at that moment.
How we built it
The backend is Python with FastAPI and SQLite, with an action executor that can’t send the same thing twice and an audit log of every step. PayPal is wired in through OAuth, the Disputes API, the Add Tracking API and signature-verified webhooks, and the adapter refuses anything that isn’t the sandbox. The AI is case-based reasoning: each situation becomes a fingerprint, we retrieve the most similar past cases, and they vote on the response, weighted by similarity and evidence quality. Actions come from a fixed list, so the system can’t invent one. The case library has 31 situation-level and 16 dispute-level cases, each labelled with its source. The frontend is React, TypeScript and Tailwind, shipped as one Docker container on Render with a private demo copy per visitor, and 148 automated tests cover it.
Challenges we ran into
The PayPal sandbox won’t create disputes through the API, so we made them by hand as the buyer. Each one also goes under review for a few minutes after every step, so we check what’s allowed before every call. We used up our only real sandbox dispute when a scripted test filed evidence on it, and every test now checks its target first. The hardest design problem was mixed parcels: when delivered and undelivered parcels sit together, the overall cause is unclear and the system rightly refuses to guess, abstaining on 12 of 18 TechKart spike scenarios. Handling each dispute on its own fixed that. We also chose to show no forecasts, because public data says how big the problem is but not which fixes worked.
Accomplishments that we’re proud of
A real seller action goes through the PayPal Disputes API behind a human click, and PayPal sits at both ends of the product, as the source of the disputes and tracking and as the place the approved action lands. On a held-out set of 18 scenarios we set before testing and ran once, MediateAI found the right cause in 9 of 13 where acting was right, against 0 of 13 without past cases. All four misses were refusals, not wrong fixes. On a 452-dispute delivery-failure test, a generic consultant made an unsupported claim on 47% of disputes and MediateAI made none.
What we learned
Grounding changes behaviour more than wording does: without past cases, the same system gives one generic answer to everything. Refusing to answer turned out to be a feature, because when its playbook was missing the system said so instead of bluffing, and that built the most trust. We also learned to say the caveat out loud. Most of our cases are written by us and our baseline is a scripted generic consultant, so our results show the method works, not what win rates a real store would see.
What’s next for MediateAI
The biggest limit is the case library, not the method. The next step is to learn from each merchant’s own closed PayPal disputes, which carry real outcomes, so the evidence goes from “illustrative” to “measured” and honest forecasts become possible. After that we’d pool anonymised patterns across merchants so a new store benefits on day one, and every dispute MediateAI handles would become a measured case when it closes. We’d also add real carrier data, more dispute types, and rules that let merchants automate the safe cases while still approving the rest. The same loop of retrieving precedent, acting with a human in control and learning from the result fits any finance decision with a history of outcomes, such as fraud review, collections or refunds.