Try it in 60 seconds

  1. Open https://moneysafe-ai.vercel.app and sign in with [email protected] / helloadmin (a public account with sample data only).
  2. On the Dashboard click Start demo to get your own copies of three example disputes.
  3. Open Disputes, then the $145 dispute ("Your copy of SEED-C", 95% win likelihood, Contest).
  4. Click Approve, choose Simulate outcome → Won, and watch the Dashboard and Insights update.

Built from scratch during the Submission Period.

Inspiration

A chargeback costs a small seller the sale, the goods and a fee (we model it as $20), and most micro-merchants have no risk team. When a dispute arrives there is a deadline and no way to know whether contesting is worth it. We wanted one screen that says "this order looks risky, and here is exactly why", and later "contest this dispute, or just refund it".

What it does

MoneySafe AI scores every PayPal order for chargeback risk from six explainable signals and shows which fired and how many points each added. For a dispute it gathers the evidence, estimates the chance of winning, recommends contest or refund with an expected-value rule, and drafts the response. The merchant approves every action before anything is sent. The Insights page learns from outcomes: it proposes capped risk-weight changes, and the merchant decides. Every PayPal call, model call, rule and merchant action is logged on the Agent Activity page.

Real PayPal disputes, including a live refund

We opened real disputes in the PayPal sandbox as a buyer. The app reads each one through the Disputes API, matches it to the captured order, and shows PayPal's own status, stage, due date and allowed actions, marked "Real, not simulated".

  • $120 "not as described": a live refund, accepted by PayPal. There was no evidence on file, so the system recommended a refund. I approved it, the app asked for confirmation ("This refunds the buyer $120.00 through PayPal"), and a live accept-claim went to PayPal through the approval gate. Agent Activity logged approve_dispute_action and accept_claim as success, and on the buyer's side PayPal shows "Case closed: the seller has sent you a full refund" for $120.00.
  • $2,600 chargeback: the AI overrides the rule. The system recommended contest. The AI changed it to refund because the carrier scans stopped at "Label Created", and the page shows that reason. PayPal allowed nothing this app can send at that stage, so it offered no button. It never fakes an action.
  • $230 inquiry: an earlier refund picked up. PayPal showed it already resolved by a seller refund that predated our call. Our own accept-claim returned HTTP 422, most likely because the dispute had closed; the app showed PayPal's error details and kept Retry, and the next sync marked it "Resolved on PayPal".

A real order or dispute is visible only to the session that owns it, so the public demo runs on labelled simulated copies.

How it works

  • Score: a pure rule engine adds weighted signals into 0 to 100 and a verdict (Ship, Verify first, Hold). The model cannot change a score.
  • Expected value: contest only if p × amount − (1 − p) × fee − effort > 0. p comes from a rubric over evidence completeness, clamped to 5–95%. The model may adjust it by at most ±0.1, or override the recommendation with a stated reason.
  • Validated tool use: the model answers through a pinned tool call checked with zod and has no write tools. If it is unavailable or over budget, the app shows the rule-based result and says "AI unavailable".
  • Approval gate: every PayPal write needs an approval record. A unique index prevents a second approval, and a retry reuses the same PayPal-Request-Id.
  • Learning loop: after enough outcomes the app proposes capped weight changes and waits for the merchant.

What is live and what is simulated

Live: sandbox order create, buyer approval and capture; add-tracking; reading real disputes with the Disputes API; a live refund (accept-claim) accepted by PayPal; scoring, evidence, win probability and the expected-value rule; Groq model calls; the approval gate. Simulated and labelled: Start demo and the seeded disputes (approval and Won/Lost outcomes), carrier scan events, and the history the learning loop starts from. Not implemented or not proven: PayPal's make-offer response, and a live evidence submission (PayPal did not allow it at the stages our real disputes reached).

Challenges

  • Disputes on demand: a sandbox dispute exists only when a buyer opens one, and its stage limits what a seller can do. So Start demo gives each visitor their own labelled copies, while real disputes stay private to their owner.
  • One database, many judges: sessions are isolated by copies, weights are shared on purpose, and there is a cooldown-protected global reset.
  • A hang through Supabase's pooler: pipelined queries left a transaction open until timeout, so we allow one query in flight per connection.
  • Free-tier model limits: a daily and a per-session cap keep the demo within quota, and past the cap everything falls back to rule-based text.

Accomplishments

  • A real PayPal sandbox refund issued from the app, behind an approval gate and an idempotency key.
  • Over 970 automated tests, plus a headless-browser suite that runs the demo script at phone, tablet and desktop widths.
  • Model output is never trusted: schemas on the way in, clamps on the numbers, and a rule-based answer behind every AI answer.

What's next

  • Support PayPal's make-offer response, and evidence submission at stages where PayPal allows it.
  • A real carrier tracking API, per-visitor database isolation, and more dispute reasons.

Built With

  • drizzle-orm
  • gpt-oss-120b
  • groq
  • next.js
  • nextauth
  • paypal-customer-disputes-api
  • paypal-orders-api
  • postgresql
  • react
  • supabase
  • tailwind-css
  • typescript
  • vercel
  • vitest
  • zod
Share this project:

Updates

Submission history