Inspiration

People now ask AI assistants what to buy. But a small seller, like a home kitchen selling laddus or a maker selling mugs on Instagram, has no product feed and no website, so to an AI shopping agent they don't exist. PayPal's own Agentic Commerce Pulse Survey found that only 23% of small businesses say 80% or more of their catalog is in AI-readable formats.

And when a buyer does shop through an assistant today, the purchase usually ends in a text link: no photo, no option, no total in the conversation, and a page they have to trust.

We wanted the opposite: the shop and the PayPal checkout inside the chat, and a way for a seller to get there by sending photos from their phone.

What it does

Shelf is the PayPal checkout that lives inside the chat.

  • Buyers ask their assistant for something ("laddu under $20"). Shelf answers with an interactive Storefront in the conversation: real photos, options and exact prices. They pick a size, add to cart, and Pay with PayPal. The card turns to Paid by itself.
  • Sellers sign in with PayPal and send phone photos. Shelf Agent reads each photo and drafts the title and description; the seller sets every price (the agent may only suggest a range). Publish, and the products are live.
  • Refunds: a buyer asks for one in the chat. No tool, agent or model can approve a refund; only the seller can, in two taps, with the amount on the button.
  • Seller desk: on a laptop, every product option and every order in one grid, built with AG Grid. Prices and stock edit in place; the server checks every change.
  • Everywhere people ask: the Storefront is an MCP App for assistants that render apps (like Claude and ChatGPT); any MCP assistant gets the same six tools (search_products, show_product, update_cart, start_checkout, get_order_status, request_refund) with plain-text answers; on WhatsApp, buyers get a PayPal Pay link and sellers can list by photo; other agents can use the Cart API, which follows PayPal's Cart API v1 shapes.

Everything runs on the PayPal sandbox; no real money moves.

How we built it

One Cloudflare Worker runs everything: Next.js 16 and React 19 (through OpenNext), the MCP server over stateless Streamable HTTP with @modelcontextprotocol/ext-apps, a queue consumer and a 5-minute reconciler. Data lives in D1, photos in R2.

PayPal:

  • Orders v2 and Payments for checkout, capture and refunds
  • JS SDK v6 on the Pay page; the Storefront opens it with ui/open-link
  • Webhooks, signature-verified
  • Log in with PayPal, so sellers sign in with the account that gets paid
  • The Cart API v1 contract for other agents

AI: Shelf Agent runs on Gemini 3.8 Flash on Vertex AI, through Cloudflare AI Gateway. It drafts products from photos (title, description, a suggested price range) and runs the WhatsApp agent with function calling over the same MCP tools. The model never sets a price, never approves a refund, and never holds a cart ID or order token.

Rules that keep money safe, each with a test:

  • The server sets every amount. A price sent by a client is ignored.
  • Every PayPal write carries a PayPal-Request-Id built from Shelf's own records (order:{cart}:v{n}, capture:{order}, refund:{request}), so a retry acts once.
  • Checkout runs in phases around the PayPal call, so a crash between creating and recording an order is repaired on the next call.
  • Webhooks are hints. After the signature check, Shelf reads the order from PayPal and applies that, through the same function as the reconciler.
  • Product, cart, order and refund states change only through explicit transition tables.

pnpm check runs 185 tests, the typecheck, a schema check, requirement traceability and a secret scan on every push.

Challenges we ran into

  • Money correctness under retries. Idempotency keys come from our own records rather than random UUIDs, and checkout is split into phases so a half-finished call heals itself.
  • Trusting webhooks without trusting them. A webhook only tells Shelf to look. The truth is always read back from PayPal, and a reconciler catches anything missed.
  • Paying from inside a chat. The Storefront can't host PayPal's buttons inside the assistant, so it opens a Pay page with ui/open-link and polls get_order_status until PayPal says Paid.
  • Keeping the AI honest. Gemini drafts, but every price is the seller's and every refund is the seller's. The model gets no tokens or IDs it could misuse.
  • WhatsApp's rules. Free-form messages only reach a person within 24 hours, and Meta's test number allows five recipients.

Accomplishments that we're proud of

  • Real sandbox payments, approval to Paid, recorded in the video: three on 12 November, plus a refund request waiting for the seller.
  • A Try page judges can use with no account and no install. It shows only products real sellers published, with no mock data.
  • One set of MCP tools behind the in-chat Storefront, plain-text assistants, WhatsApp and the Cart API.

What we learned

  • Agentic commerce is mostly about trust boundaries. The interesting work was deciding what the model may never do: set a price, approve a refund, see a token.
  • PayPal's idempotency and Orders v2 make safe retries straightforward once keys come from your own records.
  • MCP Apps make the chat a real storefront, not a link at the end of a conversation.

What's next

  • Verify the Storefront inside Claude and ChatGPT with the connector added. It's built and tested through the same host bridge on the Try page, but not yet confirmed in each assistant.
  • Finish verifying the WhatsApp agent live, and add Meta's approved template for "New order".
  • Partial refunds, multiple currencies and Web Push for sellers.
  • PayPal Partner Referrals for seller onboarding and platform fees, which need PayPal Platform approval in production.

Built With

  • ag-grid
  • cloudflare-ai-gateway
  • cloudflare-d1
  • cloudflare-queues
  • cloudflare-r2
  • cloudflare-workers
  • drizzle
  • gemini
  • log-in-with-paypal
  • mcp-apps
  • model-context-protocol
  • next.js
  • opennext
  • paypal
  • paypal-cart-api
  • paypal-js-sdk
  • paypal-orders-v2
  • paypal-payments
  • paypal-webhooks
  • react
  • typescript
  • vertex-ai
  • whatsapp-cloud-api
  • zod
Share this project:

Updates

Submission history