Inspiration

A dispute says something went wrong, not who caused it. "This bag is ground" can mean the merchant packed the wrong bag, or that the buyer's shopping agent ordered the wrong one. Those deserve opposite answers: offer a return, or refund under the merchant's policy. As AI agents start buying for people, merchants will get more disputes where the honest answer depends on what the buyer told their agent, and today's dispute tools can't see that.

Who it's for: merchants who take PayPal and whose buyers increasingly shop through AI agents, and the people on their teams who answer disputes.

What it does

For each PayPal dispute, Witness keeps three questions apart:

  1. Did the buyer authorize this agent to buy? The buyer's mandate (budget, merchant, item instructions) is bound to the order by its SHA-256 in PayPal's custom_id, and counts only if it was in force at purchase time and linked to the buyer's own PayPal approval.
  2. Did the agent buy what it was told to? Claude compares the buyer's instructions with what the agent bought and what the listing promised, citing the facts each conclusion rests on.
  3. Did the merchant deliver what was ordered? Only a delivered tracking record counts as delivery.

It then decides by the reason PayPal records for the dispute, using only the responses PayPal allows on the case right now: provide evidence, send a message, offer a return, accept the claim. Anything it can't establish becomes a visible gap and a request for evidence, never a silent refund. A person reviews the investigation in the desk and presses one button to send exactly what they reviewed.

How we built it

  • PayPal (sandbox): Disputes API across the whole lifecycle (read, provide evidence and supporting info, message, accept, offer, escalate, and the sandbox-only settle call), Orders v2 and Payments v2, shipment tracking, Orders v2 with vault so the buyer saves PayPal for their agent, and the PayPal Agent Toolkit (read-only) in the desk chat.
  • Claude: reads the buyer's words and compares instructions, purchase and listing; writes the notes for PayPal and the message to the buyer. Code decides: every statement must cite a supplied fact or it isn't sent.
  • AG Studio (AG Grid): the investigation desk: custom widgets, a theme of its own, and two custom agents (Witness and PayPal records) that AG Studio's built-in lead agent delegates to. AG Studio's own agents built the dispute queue page from a written brief; we then tuned it by hand.
  • TypeScript, Node 22, zod, vitest; hosted on AWS behind Caddy.

Challenges

PayPal's sandbox taught us what it really accepts: evidence files must be PDF or images, so Witness writes the evidence pack as a PDF; the sandbox refused PROOF_OF_FULFILLMENT in every form for not-received claims, so defences send OTHER with the delivered tracking in the notes; a return needs the merchant's return address. PayPal's approval page shows only the payment, so the buyer accepts the mandate's terms on Witness's page and then approves a first payment at PayPal, which Witness checks at dispute time.

Accomplishments

  • End to end on the sandbox: an agent bought ground coffee against the buyer's "whole bean, never ground" mandate (accepted and approved at PayPal), the buyer disputed it, Witness found the agent at fault, a person sent the refund, and PayPal closed the case in the buyer's favour (PP-R-ZLP-10194382). PayPal's own case page shows the refund and Witness's explanation word for word.
  • On 18 synthetic eval cases whose labels were committed before any run, the current rules-only baseline decides 16 (13 when the Claude run was taken) and Witness (anthropic/claude-opus-5.5) decided all 18 in one run; the label match measures the chosen action only, not evidence quality or outcomes; on the 5 demo cases, 3 and 5. Synthetic cases and single runs: not a measure of real disputes.

What we learned

A valid mandate never means "defend" on its own: an authorized purchase can still break the buyer's instructions or never arrive. Keeping those questions separate is the whole product.

What's next

Real merchant pilots on live PayPal, signed mandates in the AP2 style instead of a hash, and more claim types.

Built during the hackathon

Started on 3 October 2026, after the submission period opened; the full history is in the repository.

Testing

git clone https://github.com/fexx301/witness && cd witness
npm ci && npm test && npx tsx eval/run.ts

Built With

Share this project:

Updates

Submission history