Inspiration
Small online sellers handle refunds from an inbox. A buyer writes three paragraphs, the seller skims them, opens the payment dashboard, and either refunds everything to be safe or refunds too little and starts an argument. The request that matters is usually one sentence. We wanted a desk that puts that sentence, the original payment and the refund decision on one screen, and that never lets software move money on its own.
What it does
- New: Returns desk: start a return from a photo of the item and the receipt.
- The merchant opens a case by pasting the buyer's message (or importing the email) and the PayPal capture ID.
- Returnlight looks the payment up in the PayPal Sandbox and shows the real amount and status. That amount becomes the ceiling for the case.
- A local AI model reads the message and highlights the exact passage that states what the buyer wants. It writes no summary, picks no category and makes no decision. The highlighted words must appear verbatim in the buyer's message or they are rejected.
- The merchant confirms they have read the request, sets the refund amount, and types a case-bound approval phrase. Nothing is sent at that point.
- Sending is a second step with its own typed confirmation. Returnlight then issues one refund against the capture through the PayPal Sandbox and records PayPal's refund reference on the case.
- If PayPal's answer is lost or unclear, the case is marked unknown and reconciled by reading the refund back. A refund POST is never repeated automatically, and one capture gets one attempt.
In the demo, a buyer paid $68.00 in the PayPal Sandbox, asked for $40 back for a cracked carafe, and the merchant refunds exactly $40.00.
How we built it
- Python 3.12 standard library for the local web server, the case state machine and the PayPal client; the browser UI is plain HTML, CSS and JavaScript.
- PayPal REST APIs in the Sandbox: OAuth, Payments v2 capture lookup, capture refund, and refund lookup for reconciliation. The endpoint is fixed to the Sandbox.
- A local model served by Ollama on loopback (qwen2.5) for the highlight. Its output is validated against the source text before it is shown.
- Cases are private local JSON files. Credentials stay in the server's environment and never reach the browser.
Challenges we ran into
- Keeping the model useful without letting it decide. Early versions produced summaries and suggested amounts; we cut it back to selecting an exact passage.
- Lost responses. A refund call can time out after PayPal has already processed it. We reserve the attempt before the POST and treat an unclear result as unknown until it is read back.
- Making two deliberate confirmations feel quick rather than bureaucratic.
Accomplishments that we're proud of
- A complete, real Sandbox journey: a captured payment, an AI highlight from a local model, a human-approved partial refund, and PayPal's refund reference on the case.
- The model cannot invent evidence: every highlight is checked word for word against what the buyer wrote.
- No path in the product sends a second refund without a person resolving the first.
What we learned
Refund tooling is mostly about restraint. The most valuable thing the AI does here is point, and the most valuable thing the software does is refuse to guess when the payment provider's answer is uncertain.
What's next
- Reading buyer messages directly from a connected mailbox.
- Multiple partial refunds per capture with a running remaining balance.
- PayPal webhooks for refund status in place of manual refresh.
- A hosted, authenticated version for small teams.
Built With
- css
- html
- javascript
- ollama
- paypal
- paypal-payments-api
- paypal-sandbox
- python
- qwen2.5
