Inspiration

Small PayPal sellers handle chargebacks badly in both directions: they refund disputes they could have won, and they fight ones they should concede. Either way, the cause is the same. Nobody has time to dig through tracking pages, emails and refund records before the deadline. I wanted an AI to do that reading.

What it does

Dispute Defender pulls open disputes from the PayPal Disputes API. Claude investigates each one by checking the order, carrier tracking, the support inbox, refunds and store policy, then recommends FIGHT, OFFER or ACCEPT. Each recommendation comes with a win probability, cited facts, PayPal evidence items and a drafted statement. The merchant reviews it, and one click sends the response to PayPal.

It doesn't fight everything. On the 9 demo disputes it fought the signed-for delivery and the already-refunded claim, and conceded the lost package and the return that was never refunded.

How I built it

  • Claude Opus 5.5 in a tool-use loop: 8 read-only tools plus a submit_case_plan tool whose strict schema is the case plan.
  • PayPal APIs: Disputes (provide-evidence, make-offer, accept-claim), Orders v2 and Webhooks, all running against the sandbox.
  • FastAPI backend, an AG Grid dispute queue, a live trace streamed to the browser, and an auto-generated evidence PDF.
  • A mock sandbox with the same interface, so the app runs with zero setup.

Fighting only pays off when p ⋅ A > c, where p is the chance of winning, A the amount, and c the cost of responding. So Claude's real job is estimating p honestly.

Challenges

  • PayPal's sandbox list endpoint lagged far behind new disputes, so I added tracking disputes by ID.
  • The default capture response leaves out line items, so orders were saved empty until I requested the full response.
  • Getting the model to concede clear losses and flag its own weak points, not just argue the merchant's side.

What I learned

Strict tool schemas make agent output reliable and auditable. In payments, human approval is part of the product, not a disclaimer.

Built With

  • ag-grid
  • anthropic
  • claude
  • claude-opus-5.5
  • css3
  • fastapi
  • fpdf2
  • html5
  • httpx
  • javascript
  • paypal
  • paypal-disputes-api
  • paypal-js-sdk
  • paypal-orders-api
  • paypal-webhooks
  • pytest
  • python
  • server-sent-events
  • uvicorn
Share this project:

Updates

Submission history