Inspiration

Many small sellers in India, like block-print studios, jewellers and illustrators, sell to buyers abroad through social DMs and chat apps, and PayPal is how they get paid. The order arrives as a chat message. Everything after that is manual: typing up an invoice, sending a pay link, checking whether it was paid, nudging politely and then less politely, adding tracking, and refunding $20 because a tassel came loose. We wanted an agent that runs that loop on PayPal's APIs while the seller stays in charge of anything that moves money.

What it does

  • Agent inbox. Paste a customer's DM, an order note or a screenshot. The agent extracts buyer, items, prices, shipping, currency and email, then calls typed tools: create and send a PayPal invoice, create a checkout link, remind, capture, add tracking, refund, cancel, or answer "who still owes me?".
  • Guardrails with a human in the loop. Every action, whether it comes from the agent, a dashboard button or the collections job, goes through one server-side dispatch(). Some actions are denied outright: INR, a hard ceiling, refunding more than was captured, reminding a paid invoice, capturing an unapproved order. Others wait in an approval queue: totals above $150, refunds above $50, first contact with a new customer, non-USD currencies, final-notice reminders and cancellations. "Approve & run" re-checks policy before it calls PayPal.
  • Payments that track themselves. PayPal webhooks (INVOICING.INVOICE.PAID, CHECKOUT.ORDER.APPROVED, PAYMENT.CAPTURE.*) are verified, deduplicated by event id and re-fetched from PayPal before the cache updates. Approved checkout orders are captured automatically.
  • Collections agent. Picks a friendly, firm or final tone from how overdue an invoice is and sends PayPal reminders, at most 2 a day. Final notices need approval.
  • AG Grid dashboard. KPI strip, an orders/invoices/payments grid with status chips and counts, quick search, column filters, a pinned totals row that follows the filter, CSV export and row actions. The approval queue grid has Approve & run / Reject, live updates come over server-sent events, and every tool call, approval, refusal and webhook is in the activity log.

How we built it

  • Next.js 16 + TypeScript, one app for both the UI and the API routes. SQLite (better-sqlite3) holds the cache, the approval queue, webhook idempotency and the audit log. PayPal stays the source of truth.
  • PayPal REST (sandbox): OAuth client credentials with a token cache; Invoicing v2 (create, send, remind, cancel, search); Orders v2 (create, capture, track); Payments v2 refunds; webhook signature verification. Every POST carries a PayPal-Request-Id, and the capture key is derived from the order id, so retries can't double-charge. Live URLs are refused by config.
  • Agent: Vercel AI SDK v7, multi-step tool calling with zod-typed tools. Providers are Gemini (free AI Studio tier, gemini-flash-lite-latest, which also reads screenshots), Groq, or an offline rule-based planner. If the LLM fails, the agent falls back to the offline planner.
  • Mock PayPal gateway that follows the documented state machines and serves stand-in buyer pages. Its "pay" button emits the same webhook events, which go through the real pipeline, so judges can run the whole demo with zero keys.
  • AG Grid Community v36 with a custom theme, cell renderers and pinned rows.
  • Tests: 61 vitest tests (12 files).
  • Live checks: npm run smoke against sandbox; npm run agent:demo end to end.

Built from scratch during the submission period (1 Oct-12 Nov 2026 PT); first commit 21 Oct 2026; no earlier codebase reused.

Challenges we ran into

  • Indian PayPal accounts can't receive payments, so the sandbox app is tied to a US sandbox business account and bills in USD. The policy refuses INR on purpose.
  • Real sandbox responses differ from what you'd assume. Creating an invoice returned 201 with only a link and no id, so we parse the href and read it back. Creating an order returned 200 with PAYER_ACTION_REQUIRED, not 201/CREATED. Sending an invoice gives SENT with a recipient email and UNPAID without one. We recorded these and made the mock match.
  • Free-tier LLMs. Standardised on gemini-flash-lite-latest with offline fallback planner.
  • Making the model safe to give money tools to. Model only proposes; policy runs server-side in one choke point.
  • An AG Grid render loop. Fixed by updating pinned totals only when the visible row set changes.

Accomplishments that we're proud of

  • Real PayPal sandbox invoice INV2-72YU-E3CK-E8MZ-229F created/sent; buyer paid; $20 partial refund; $500 held for approval.
  • Live sandbox smoke 17/17.
  • Zero-config judge demo path.
  • One audited idempotent action layer.

What we learned

  • Treat PayPal as source of truth; verify/dedupe webhooks then re-fetch.
  • Idempotency keys and approval gates matter more than prompt wording.
  • Record real API responses early.

What's next for SellerPilot

  • Public demo + sandbox webhook.
  • AG Studio analytics dashboard.
  • Currency-aware totals, voice-note orders, reminder tone history.

Built With

Share this project:

Updates

Submission history