Inspiration
When a buyer opens a dispute, the two sides trade messages without a shared view of the facts. The records sit in different places, and neither side usually knows which PayPal rule applies or what proof is missing. Evidence collection is merchants' top problem in disputes (Chargebacks911, 2026), and a dispute that becomes a chargeback costs a merchant about $128 all-in (PayPal Business Resource Center).
PayPal's inquiry stage already gives the buyer and the seller time to talk it out. I wanted to give them the same facts to talk about.
What it does
Parley is a prototype of a capability PayPal could add to its Resolution Center. It activates when a buyer opens a dispute in PayPal.
- Imports the dispute from PayPal. The order, payment, tracking and messages become numbered evidence, each with a sha256 fingerprint.
- Lets either side add evidence. A statement or a photo. Both sides see the same case file.
- Links claims to evidence. AI lists what each side claims and ties every claim to its evidence with an exact quote. Claims with nothing behind them are marked "Unsupported".
- Runs a Policy check. It names the published PayPal rule that applies, says what it implies for cases like this, and lists the evidence that is missing. It never predicts PayPal's decision.
- Prices two or three ways to settle with plain code. A full refund is always one of them.
- Settles on PayPal's own dispute. For a partial refund, the seller sends the offer from Parley and the buyer accepts it in PayPal itself. For a full refund, the buyer agrees in Parley, the seller confirms, and PayPal refunds and closes the case.
Escalating to PayPal stays one click away at every step.
How I built it
- App: Next.js (App Router), TypeScript and Tailwind CSS, hosted on Render.
- PayPal: the official Server SDK for orders, payments and tracking, and direct calls to the Disputes API v1 to read disputes, send offers and close with a full refund. Everything runs in the PayPal sandbox.
- AI: Gemini through the Vercel AI SDK. Every answer is forced into a fixed schema.
- Checker: plain code that runs after every AI call. It removes any evidence ID that does not exist, any quote that is not found word for word in the evidence, and any rule that is not in the list. It rejects sentences that predict PayPal's decision.
- Data: Supabase for the database and private photo storage.
How the AI is kept in check
- The AI only organizes. It has no tools and cannot reach PayPal or the database. Only a person's click sends anything to PayPal, and amounts are capped.
- Evidence is wrapped as data, so instructions hidden inside a message or statement are not followed. The test case includes one.
- A photo's AI description is labelled as what a model sees in the image, not a verified fact.
- The finished demo cases load a saved analysis, so they never wait for a model.
Challenges I ran into
- What an app may do for a buyer. With seller access, an app cannot open a dispute for a buyer or accept an offer as the buyer. So the buyer opens the dispute and accepts partial offers on PayPal, and Parley drives the seller's side. This matches how PayPal works in real life.
- Turn order. A seller's message hands the turn to the buyer and switches offers off, so Parley puts the seller's message inside the offer.
- Inquiry versus claim. An "item not received" dispute on an order with tracking becomes a claim at once, where offers are not available. Parley reads the dispute's allowed actions before every step, so its buttons never offer more than PayPal allows.
- A busy free AI tier. Parley falls back to a second model, waits and retries.
Accomplishments that I'm proud of
Using the potential of AI to make inferences from a contextually larger amount of data, providing a smoother the user experience and saving people's time (everyone who involves themselves in the dispute process).
What I learned
PayPal's dispute flow already has the right stages. What was missing was a shared, organized view of the facts and the rule, early enough to matter. AI makes that careful read practical for a $30 order as much as a $3,000 one, as long as code checks its work and people make the decisions.
What's next for Parley
- Identify each side through their PayPal login. The prototype has no login, so one person can open both views.
- Read documents attached on PayPal's own dispute form.
- Return-based offers, and a clear return step for full refunds.
An honest limit: Parley cannot detect an edited photo or a false tracking number. It shows where each item came from and leaves the judgment to people, or to PayPal on escalation.
Built With
- gemini
- nextjs
- paypal
- paypal-disputes-api
- paypal-server-sdk
- postgresql
- render
- supabase
- tailwindcss
- typescript
- vercel-ai-sdk
- zod