Inspiration
Small online sellers handle every customer problem themselves. A cracked mug, a missing parcel, a "please pause my subscription" email: each one means reading the message, remembering the refund policy, checking the order, deciding what's fair, and then moving the money. It's slow, and the answers drift from one day to the next.
I wanted to see how much of that thinking an AI could prepare while a person keeps the final say, and PayPal does the actual money movement.
What it does
Refy is an AI customer resolution desk for small sellers who take PayPal payments.
- A customer pays through PayPal checkout and later reports a problem in plain language.
- The AI reads the complaint, the order, the customer's history, and the shop's written refund policy.
- It recommends one of six outcomes, full refund, partial refund, status reply, pause subscription, hold for review, or deny, with its reasoning, the policy rules it applied, a confidence level, and a drafted reply to the customer.
- The merchant reviews it on a dashboard and approves with one click. For refunds, PayPal sends the money back, and for subscription requests, PayPal pauses the subscription.
- An analytics dashboard shows outcomes, refunded dollars, and recent requests.
Safety by design
- A person approves every action.
- The AI never touches PayPal credentials. It only returns a decision, and server code decides whether to carry it out.
- Server code caps every refund at what was paid minus what was already refunded, and a decision can't be executed twice.
- Customer messages are treated as untrusted text in the prompt.
The store, the report-a-problem form, and the help chat are a demo harness standing in for a merchant's existing shop, so the whole flow can be tried end to end. The product is the merchant side.
How I built it
- PayPal (sandbox): the JavaScript SDK for checkout buttons, the Orders API to create and capture payments, the Payments API to refund a capture, and the Subscriptions API to suspend a subscription.
- AI: Google's Gemini API ([model name]) returns structured JSON for each triage, which I validate with Zod, retry once on bad output, and clamp in code. A second, separate chat assistant answers customers' policy questions and can look up an order's status, but it has no tools that can move money.
- AG Grid powers the merchant queue, and AG Studio powers the analytics dashboard, both themed to match the app.
- Next.js and TypeScript run the pages and server routes, with SQLite for data and Motion for animation. It's hosted on Render.
Challenges
- Free hosting resets data. The free tier's filesystem is ephemeral, so the database is wiped on restart. The app reseeds its sample data on boot.
- Keeping the AI honest. Models sometimes return malformed or overconfident output, so every response is schema-checked, retried once, and clamped by code before it can touch money.
- PayPal's approval flow. A buyer has to approve a sandbox order in PayPal's own window, which was blocked on some networks and browsers. A seller account also can't pay itself.
- Double refunds. I made the approval step claim a decision atomically, so a double click can't refund twice.
- New tooling. AG Studio is new, so setting up its theming, layout, and saved dashboard state took a lot of reading.
What I learned
Let the model decide and let code enforce. The AI is good at reading messy complaints and weighing a policy, but anything involving money belongs behind validation, limits, and a human. I also learned how PayPal's order, capture, and refund model fits together, and why the sandbox accounts matter.
Honest limits and what's next
- It runs on the PayPal sandbox with test money.
- Past cases on the dashboard are sample data, and shipment tracking is simulated.
- There's no login, and complaints come through a form. Next steps are merchant accounts, connecting a merchant's real PayPal account, and pulling complaints in from email and chat.
Built With
- ag-grid
- ag-studio
- ai-agents
- better-sqlite3
- gemini-api
- google-gemini
- motion
- next-js
- node.js
- paypal
- paypal-javascript-sdk
- paypal-orders-api
- paypal-payments-api
- paypal-sandbox
- paypal-subscriptions-api
- react
- render
- sqlite
- typescript
- zod

Log in or sign up for Devpost to join the conversation.