Inspiration

Small distributors, like the companies that supply restaurants and cafes, still take most orders by text, email and handwritten notes. The orders are informal: half English, half Spanish, no SKUs, loose quantities, like "Necesito 10 paquetes de servilletas y 4 jugs of dish soap para mañana." Someone retypes every order into an invoice by hand and then chases the payment. It's daily, error-prone work, and it's a good fit for an agent that does the busywork but leaves the final decision to a person.

What it does

OrderDesk turns a messy order into a priced PayPal invoice that the owner approves and sends in one tap, then tracks payment.

Try it live: https://orderdesk-g9ph.onrender.com/ (PayPal sandbox only, no real money moves)

  1. Order in. Orders land in an inbox as texts, emails and photos, the way they arrive. Phone or paper orders can be pasted on the New order page, with an optional photo of a handwritten list.
  2. Agent reads it. Open a message and Claude reads it right away. It looks up each product in the catalog, converts cases to units, and prices every line. Anything unclear is flagged with a reason instead of being guessed.
  3. Owner reviews. Edit quantities right in the order grid (totals update instantly, prices stay locked to the catalog), answer flags in one click, and confirm who the invoice goes to. An Agent activity timeline shows every catalog search, owner edit and PayPal call as it happens.
  4. Approve. Only then does an agent use PayPal's Agent Toolkit to create and send the invoice.
  5. Paid. A PayPal webhook marks the order paid. No chasing.

The inbox opens with seven sample messages from three restaurant customers (Rosa's Taqueria, Main St Cafe and Harborview Diner). Each one tests one behavior:

  • Clean: "2 cases" of cups becomes 40 sleeves, using the catalog pack size
  • Spanish/English mix: servilletas is matched to napkins, and para mañana becomes the delivery note
  • Ambiguous: "5 cases of cups and some napkins, same as last time" produces three flags and zero guesses
  • Out of stock: 30 requested with 25 in stock, so it offers "Send 25 now"
  • Unknown item: a product the distributor doesn't sell is flagged and the rest of the order is still priced
  • Handwritten photo: Claude vision reads a photographed list
  • Email forward: the signature and the older quoted order are ignored

Owners can also send payment reminders and generate a QR code for counter payments. The Orders page groups orders by status or customer, with a status filter and a running count and total.

A Reset demo button puts the live site back to fresh sample messages, so every judge can try the full flow from the start.

How I built it

One Next.js 15 app (App Router, TypeScript, Tailwind) does everything. The only other services are Claude, the PayPal sandbox and Postgres.

  • Parsing agent: Vercel AI SDK with the Anthropic provider (claude-sonnet-5-5). It uses structured output and a single tool, search_catalog. It also handles vision for handwritten orders.
  • Invoicing agent: @paypal/agent-toolkit in sandbox mode, limited to invoice tools: create_invoice, send_invoice, get_invoice, send_invoice_reminder and generate_invoice_qr_code.
  • Webhooks: every PayPal webhook is verified with /v1/notifications/verify-webhook-signature before it's trusted. INVOICING.INVOICE.PAID and INVOICING.INVOICE.CANCELLED update the order.
  • Data: Postgres on Neon with Drizzle ORM. Locally the app falls back to embedded PGlite, so npm run demo works with no database setup.
  • UI: an inbox of incoming messages; a review screen with an AG Grid order-lines editor and a live Agent activity timeline; and an AG Grid Orders page grouped by status or customer, with a status filter and a pinned total row. All AG Grid Community.
  • Hosting: Render web service via render.yaml.

Three design decisions

The model never sets a price. The parser returns only what the customer asked for: a SKU that search_catalog returned, a quantity, and whether it was counted in cases. Names, prices, case sizes and stock are applied in code. A SKU that isn't in the catalog is dropped and the line is flagged, so an invented product or price can't reach an invoice.

The approve route is the only path to PayPal. The parsing agent has no PayPal tools. They exist only inside POST /api/orders/[id]/approve, which refuses any order with a flagged line, a missing quantity or no billing email.

Approval is enforced in code, not in the prompt. The invoicing agent's PayPal tools are wrapped in a guard. create_invoice is rejected before it reaches PayPal unless every line's quantity and unit price, the total, the currency and the recipient match what the owner approved. send_invoice only accepts the invoice that was just created. After sending, the invoice total is read back from PayPal and checked again.

Challenges I ran into

  • Keeping the agent useful without letting it decide. Vague lines like "some napkins" tempt a model to fill in a value. The schema makes it flag uncertainty with a reason instead.
  • Guardrails that hold up. A prompt that says "only invoice what was approved" isn't a control. I moved the check into a wrapper around the toolkit tools, so a mismatched invoice never reaches PayPal.
  • Messy, real-world input. Mixed languages, case and unit conversion, out-of-stock partial fills, and email threads with old quoted orders all needed explicit handling and tests.
  • Webhook trust. Every incoming event is signature-verified, and a Refresh button falls back to get_invoice if a webhook is delayed.

Accomplishments that I am proud of

  • An end-to-end flow on the real PayPal sandbox: from a messy text to a sent invoice, a buyer payment, and the order marked Paid by webhook.
  • A clean separation between what the AI decides (what the customer meant) and what code decides (prices, stock, what gets invoiced).
  • Offline tests for catalog search, pricing, the approval guard, a scripted agent run and webhook handling, plus live tests for all seven sample orders.
  • A one-command local demo (npm run demo).

What I learned

  • PayPal's Agent Toolkit makes it quick to give an agent real payment capabilities, which is exactly why the guardrails around it matter.
  • Structured output with a narrow tool gives far more reliable results than asking a model for a finished invoice.
  • Flagging beats guessing. Owners trust the tool more when it says "I'm not sure, here's why."

What's next for OrderDesk

  • Inbound order channels: SMS and email straight into the queue.
  • Customer-specific memory, so "same as last time" resolves to the previous order.
  • Catalog import from existing spreadsheets or POS systems.
  • Production PayPal onboarding for real distributors.

How AI tools were used

  • In the product: Claude (claude-sonnet-5-5) reads orders with structured output and a catalog search tool, reads handwritten photos with vision, and drives PayPal's Agent Toolkit to create and send invoices.
  • In development: I designed the product, the architecture and the guardrails (code-enforced approval, the model never setting prices, the approve route as the only path to PayPal), and chose the stack and test cases. I used Claude Code as a coding assistant to implement and iterate on that design, write tests and speed up UI work, reviewing and directing the changes throughout. All code was written after October 1, 2026.

Built With

Share this project:

Updates

Submission history