Inspiration

Picture a cross-border Shopify merchant with 38 PayPal disputes a month that loses about 60% of them while its CX lead burns 25 hours a month in the Resolution Center (a simulated buyer persona from a discovery exercise, not a customer). Not because they're wrong, but because the window is short, the evidence is scattered across three systems, and nobody has priced whether fighting is even worth it. They have been burned by vendors who take a cut of every win. The PayPal Disputes API exposes the whole lifecycle in the sandbox and almost nobody builds on it.

What it does

New disputes arrive by webhook (or sync) and appear as deadline-bound blocks on a triage board. Verdict gathers what the merchant can actually prove: the capture, its invoice and custom ids, shipment tracking, the buyer's dispute history, the merchant's policy. A deterministic expected-value engine prices three options: fight (win probability × stake, minus PayPal's dispute fee and labour), offer (a partial refund, weighted by acceptance odds), accept. Claude drafts the narrative from those facts only. A human clicks approve, and Verdict files through provide-evidence, make-offer, or accept-claim, choosing the action from the dispute's own HATEOAS links.

In a simulated 50-persona discovery programme, buyers treated the deadline clock, the priced decision and the approve click as the product, and several wanted no AI drafting at all. So there is a header toggle, "Drafting: AI | Template". In Template mode Claude is not called: the response is built sentence by sentence from the facts on file, and the detail view labels which one you are reading. Every file, offer and accept stays a per-case click.

Candidly: tracking is entered by hand in the demo (labelled), and the win rates are the engine's own estimates, not PayPal statistics.

How I built it

Go, Preact, Postgres, the shared paypalgo library. The EV engine has base win rates per reason code with evidence lifts, unit-tested across the reason codes. The LLM call is schema-constrained: narrative, evidence types from a fixed enum, a one-line board summary. Buyer text is escaped and delimited as untrusted. Sandbox lifecycle helpers (escalate, require-evidence, adjudicate) are labelled scenarios in the UI.

Challenges

PayPal's merchant-side dispute creation needs buyer-side app credentials, so the test dispute was filed the way real buyers file them: from the sandbox Resolution Center. The list endpoint lags the sandbox by minutes while direct GETs are instant, so sync accepts ids. provide-evidence rejects multiple evidence items without item ids; one combined item works. The sandbox never surfaced the adjudicate link, so the demo ends at "filed, under review", which is where a real merchant's work ends too.

Accomplishments

A real dispute, $31.00 item-not-received, assessed honestly: 15% win and accept with no tracking; 92% win and fight once a delivered-with-signature tracking number was on file. Evidence accepted by PayPal at both the inquiry and claim stages.

What I learned

The decision has to be money, not vibes. Once fight/offer/accept is a formula with the fee in it, the model's job shrinks to writing a good paragraph, and that's a job it does well.

What's next

A backtest on the merchant's own closed disputes, Shopify/Etsy order connectors for automatic tracking, Bryntum's toolAdapter so an external agent can drive the board, and a serial-disputer signal from Transaction Search.

Built With

  • bryntum
  • claude
  • go
  • paypal-disputes-v1
  • paypal-payments-v2
  • paypal-webhooks
  • postgresql
  • preact
  • render
Share this project:

Updates

Submission history