Inspiration

Checkout is still a form-filling chore: search ten tabs, compare prices, re-type your details. Meanwhile AI agents can act, and PayPal moves money. We wanted the shortest path between "I want wireless earbuds under $60" and a paid order — a conversation, not a checkout form. PayPal's own agentic-commerce push made this the obvious hackathon build.

What it does

Checkout Agent is a chat UI powered by a Gemini function-calling agent: You describe what you want in plain words ("find me wireless earbuds under $60", or "put together a fitness gift bundle under $100"). The agent searches the product catalog, recommends options with exact prices, and — only after you confirm — creates a PayPal order (Orders v2, intent=CAPTURE). If nothing matches, the agent says so plainly and suggests the closest items by use as labeled alternatives — it never invents a product. A Browse catalog button renders the same catalog in a sortable, filterable AG Grid grid; clicking a row starts a chat about that product. You approve on PayPal's hosted page (sandbox for the demo); the server captures the payment and the chat shows a receipt with the capture ID. The order card then flips to captured with the amount, its Approve button disappears, and the chat posts a payment confirmation — the completed state lives in the conversation, not just in a one-time banner. Bundles: ask for a gift set and the agent assembles 2–4 products under your budget into a single PayPal order with an itemized breakdown — one payment, one receipt. All money operations happen server-side; the browser never sees secrets or amounts. Every demo dollar is PayPal sandbox money.

How we built it

Agent: Google Gemini (gemini-3.8-flash) with function calling — a small explicit tool loop (no black-box framework), tools: search_catalog, list_catalog, create_paypal_order, check_order_status, capture_paypal_order. Payments: PayPal REST — POST /v1/oauth2/token, POST /v2/checkout/orders (with item breakdown + idempotency keys), POST /v2/checkout/orders/{id}/capture. Approval via PayPal's hosted approve URL; return_url handler captures on redirect. Catalog browser: AG Grid Community renders the 12-product catalog in a sortable, filterable grid, fed by a new GET /api/catalog endpoint — the grid and the agent read the same catalog.json, one source of truth. API docs: the API is documented as an OpenAPI 3.0.3 spec (openapi.json in the repo). Stack: Python, FastAPI, vanilla JS chat UI (no build step), 12-product JSON catalog. AI-assisted build: scaffolded and iterated with AI coding assistance (allowed by the rules).

Challenges we ran into

Sandbox ≠ real PayPal: approving a test order requires separate sandbox test accounts — your real login doesn't exist there. Cost us 20 confused minutes. Model churn: the Gemini model name we started with was retired mid-build; the API error message itself told us the replacement. Agent loop discipline: the first bundle attempt sent the model into an endless re-search spiral (AND-matching returned empty). Fixed with ranked OR-matching, a 2-search limit, and a forced closing reply. The PayPal redirect is a fresh page in a new tab: after approval, the order card from the creation tab didn't exist on the return page, so the captured state had nothing to update. Fixed by persisting orders in the browser, re-rendering the matching card on return, and flipping the original tab live.

Accomplishments that we're proud of

A real end-to-end purchase in the PayPal sandbox: agent → order → human approval → capture COMPLETED ($49.99), plus a 2-item bundle order ($99.98) — verified via the PayPal API, not mocked. The bundle flow: one conversation, one PayPal order, itemized receipt. That's the agentic-commerce moment. Honest no-matches: the agent says what it doesn't carry and suggests labeled alternatives instead of hallucinating a product — the right failure mode for an agent that spends money.

What we learned

PayPal's Orders v2 flow (create → approve → capture) maps perfectly onto an agent's tool loop: the agent's "hands" are just API calls, and the human stays in control at the approval step — the right trust boundary for agents that spend money. APPROVED ≠ paid. The capture call is where money moves; demo accordingly.

What's next

Live product APIs instead of the static catalog; refunds via chat ("return the earbuds"). PayPal's MCP server as the tool layer for deeper agentic-commerce integration.

Built With

  • ag-grid
  • apimatic
  • fastapi
  • google-gemini
  • paypal
  • paypal-orders-api-v2
  • python
  • sandbox
Share this project:

Updates

Submission history