Inspiration

For a small online shop, one PayPal dispute can cost more than the order. Lose a claim and PayPal keeps a $15 fee on top of the refund. Once claims pass 1.5% of sales, every claim costs $30, even the ones you win. The seller usually has ten days to answer, and Seller Protection only helps if the order went to the right address with the right proof. Small sellers rarely know these rules, so they refund cases they would have won and fight cases they were always going to lose. The services that exist mostly take a cut of what they win back. I wanted an agent that does the reading, the arithmetic and the writing, and leaves the decision with the seller.

What it does

Truce handles a shop's PayPal disputes from start to finish:

  • Reads each case live. It gathers the evidence: the order and payment, the tracking, the listing as the buyer saw it, the shop's policies, the messages, the buyer's photos and similar past cases. It checks Seller Protection rule by rule.
  • Prices every move. For fight, settle and refund it works out the expected loss, the worst case, the dispute fee and whether the move counts toward the claims ratio.
  • Recommends one, with reasons. Every reason cites its evidence (E1, E2…). If it doesn't pick the cheapest move, it has to say why. A $5 offer for a cracked mug the shop's own policy promises to refund isn't fair, so it recommends the refund.
  • Drafts the reply and checks it. The draft is a reply, an offer, a refund note or the evidence for PayPal's reviewer. Every factual sentence is checked against the evidence before the seller sees it.
  • Acts only on approval. One tap sends it through PayPal's Disputes API: a message, an offer, a refund, or proof of fulfillment.

Around that:

  • Ask Truce is each shop's home: a chat with eight tools. It answers "Which case should I deal with first?" or "Why did we lose the mug dispute?" Told "Refund Chris and say sorry", it prepares the refund as a card the seller approves.
  • Prevention. Before an order ships, Truce checks the label against the address on the PayPal payment. A different address voids Seller Protection, so Truce drafts a kind note asking the buyer to fix it.
  • The overnight check syncs new disputes from PayPal, sorts them, and checks every order waiting to ship.
  • Shop health shows what Truce has kept, the fees avoided, the claims ratio against PayPal's line, and the patterns behind the shop's disputes, with how to prevent them.

To try it, sign up and open the sample shop, Wick & Ember. It's your own copy, with about 240 orders, five open disputes that each need a different move, and twelve closed ones. Or connect your own PayPal REST app, sandbox or live.

How I built it

NVIDIA Nemotron on Nebius Token Factory, routed by difficulty. Every model call goes to Token Factory through its OpenAI-compatible API, with the stock openai SDK and my own tool loop. Each job uses the model that suits it, which is what this track suggests:

Step Model Why
Triage, gather (with tools), weigh the evidence Nemotron 3.5 Lightning Fast and cheap, thinking off: answers in about 0.5 s
Read the buyer's photos Nemotron 3.5 Super VL, thinking on Reads a ruler or a crack in a photo
Draft, and the Ask Truce chat Nemotron 3.5 Super VL Good writing, sees the photos, quick tool use
Decide fight, settle or refund Nemotron 3 Ultra, thinking on The hardest judgement
Check every sentence of the draft Nemotron 3 Ultra A strict reader
Find similar past cases Qwen3 Embedding 8B (on Token Factory) Embeddings, cached by text
  • Structured answers. The triage, the evidence strength, the decision and the check come back as forced tool calls (tool_choice names one tool) with zod schemas. Each answer is validated, including across fields: every cited evidence ID must exist, and a move other than the cheapest needs a reason. If an answer fails, the model gets the exact error and one more try.
  • Thinking per step. chat_template_kwargs: { enable_thinking: false } turns Nemotron's reasoning off where it doesn't change the answer. It stays on for Ultra's decision and Super VL's photo reading, where it does.
  • Everything streams. Each analysis step streams to the browser as it happens: the steps, a chip for each tool call, the draft as it's written, and the cost of every call.
  • Rules in code, not the model. Fees, deadlines, the claims ratio, Seller Protection and the cost of each move are tested functions, from PayPal's published rules. The models read, reason and write; they never do the arithmetic.
  • Cheap enough for a flat price. A whole case costs $0.010 to $0.020, about 1.3¢ on average. Every call's tokens and cost are recorded per step and model.
  • Safe by design. Buyer text reaches the models fenced as untrusted data. Evidence records are written by code from the shop's own data. Nothing a model writes is sent without the seller's tap. PayPal secrets are sealed with AES-256-GCM.
  • PayPal. Disputes v1 (send-message, make-offer, accept-claim, provide-evidence with a PDF, provide-supporting-info), Orders and Payments v2, order tracking, Transaction Search for the claims ratio, and per-shop webhooks checked with verify-webhook-signature.
  • Tavily reads the listing and the shop's policies from the shop's own website, as evidence that cites its page.
  • Stack. Next.js 16 and React 19 on Google Cloud Run; Firebase Authentication; Firestore; Cloud Scheduler for the nightly check; Secret Manager. Over 400 tests cover the rules, the agent (on a fake Token Factory) and the routes.

Challenges I ran into

  • Structured output without JSON mode. Token Factory doesn't list JSON mode for Nemotron, so every structured answer is a forced tool call. Constrained decoding was slow with string length limits in the schema: a forced call on Lightning took 17.6 s with minLength and maxLength, and 0.6 s without them. The model now sees the schema without length limits, and zod enforces them afterwards.
  • Keeping the numbers exact. A model can't be trusted with fees, deadlines and win chances, so every figure comes from code, and the model has to argue from the numbers it's given. Code then checks every amount and tracking number in the draft.
  • A demo that's fast and affordable for every judge. In sample shops, the first clean live run of each case is recorded and replayed in about ten seconds for later visitors. A real shop always runs live. Rate limits, a daily spend cap and a queue keep Token Factory credits safe through judging.
  • The PayPal sandbox. Sandbox disputes are opened by hand from a buyer account and reach the API about seven minutes later, already as claims. The unauthorized reason code is spelt UNAUTHORISED.
  • Nebius AI Cloud. I planned to run the overnight work on Nebius Serverless Jobs, but AI Cloud wouldn't allow writes until its own separate billing was set up. The background work runs on Google Cloud instead, and every model call stays on Token Factory.

Accomplishments that I'm proud of

  • A complete product, not a proof of concept: sign-up, onboarding, a real PayPal connection, a sample shop anyone can try, approvals that go through PayPal's API, chat, prevention, the overnight check and shop health.
  • The right call on all five sample cases, each a different move: fight with tracking, settle for $10, fight with proof for PayPal, refund by the shop's own policy, and refund when there's no proof of delivery.
  • The check. Every factual sentence carries its evidence ID. Ultra checks each one, and code checks what code can be sure of: amounts, tracking numbers and cited IDs.
  • About 1.3¢ a case, so Truce can charge a flat price instead of a cut of what it wins.

What I learned

  • Routing by difficulty pays. Lightning handles most calls in about half a second. Ultra is worth it for two steps, the decision and the check, and those make most of the cost.
  • Thinking matters most for vision. Without it, one Super VL reading in two of a ruler photo was an inch off, and the draft repeated the mistake. With it, every reading was right.
  • Let the models explain and the code count. The agent became trustworthy once it couldn't touch the numbers.

What's next for Truce

One-click PayPal connect (partner onboarding), carrier tracking APIs for real scan data, email notifications, and billing at a flat price: never a cut of what the seller wins.

Built With

  • cloud-firestore
  • cloud-scheduler
  • firebase-authentication
  • google-cloud-run
  • nebius-token-factory
  • nemotron-3-ultra
  • nemotron-3.5-lightning
  • nemotron-3.5-super-vl
  • next.js
  • nvidia-nemotron
  • paypal
  • qwen3-embedding
  • react
  • secret-manager
  • tailwind-css
  • tavily
  • typescript
  • vitest
  • zod
Share this project:

Updates

Submission history