Inspiration

AI agents are starting to shop for people, but nobody wants to hand an AI their wallet. Budgets drift, prices get made up, and no one can prove who approved what. I wanted agentic commerce where the AI does the tedious part (searching, comparing, explaining, preparing the order) and the human keeps the one decision that matters: approving the payment.

I built Shopipal for:

  • Shoppers on a budget who want two or three good options instead of endless scrolling.
  • Small merchants who need every AI-assisted sale tied to a PayPal capture they can audit.
  • Creators who refer shoppers and deserve credit they can verify.

As a builder in Kenya, I compare shilling prices with dollar budgets every day, so currency had to be handled correctly from the start.

What it does

Ask → AI recommends within budget → server-priced review → you approve → PayPal sandbox capture → receipt → commission in the AG Grid merchant studio

  • Ask in plain English. Type "Find socks under $20". The agent searches with real tool calls and suggests 2–3 options with reasons. Budgets come from what you type: "under $20" becomes a strict $19.99 limit, never above your budget box or the $80 hard cap. The model can't raise it.
  • Review. The server sets the price and holds the quote for 15 minutes. The review card shows the item, merchant, price, budget, cap and any creator referral.
  • Approve, then pay. The PayPal button appears only after you click "I approve this purchase". The server records that approval and refuses to capture without it. You pay in PayPal's own sandbox popup and get a receipt with the PayPal order and capture IDs.
  • Creator referrals. With ?ref=alice (15%) or ?ref=bob (10%), commission is recorded only after PayPal confirms the capture:

$$\text{commission} = \left\lfloor \frac{\text{price in cents} \times \text{rate in basis points}}{10\,000} \right\rfloor$$

For example, Cloud Crew socks at \( \$16.00 \) give Alice \( \$2.40 \). The commission is part of the price, not an extra charge.

  • Merchant studio. A passphrase-protected AG Grid dashboard lists every order with payment status, PayPal order and capture IDs, referral and commission owed. Columns can be sorted and filtered, and summary tiles show completed sales, captured volume and total commission owed.
  • More places to shop. The same agent searches real retailer listings through Channel3 (you buy at the retailer) and a Shopify store of printable books priced in KES, converting prices to your USD budget at a live daily exchange rate.

How I built it

  • Next.js 16, React and TypeScript on Vercel, with Turso/libSQL and Drizzle ORM.
  • AI agent: an OpenRouter model running in the Vercel AI SDK ToolLoopAgent, limited to 5 steps and 1,200 output tokens per request. The model decides what a vague request means, which source to search, and which options to recommend. Prices, budgets and currency are handled by deterministic server code.
  • Six tools, and none can spend money: search_products, get_product, prepare_checkout, search_store_books, prepare_store_checkout, search_market_products. Each one only searches or prepares a review. None can approve, create a PayPal order, capture, refund or pay out.
  • PayPal Orders v2 + JS SDK Buttons (sandbox only):
    • The server rechecks amount, currency and the receiving merchant on create and capture.
    • PayPal-Request-Id idempotency keys and a database lease prevent double captures.
    • A "Check payment status" path recovers a payment whose confirmation was lost, without charging again.
    • Live mode is refused in code.
  • Channel3 search API for real retailer offers. The server rechecks every offer (USD, in stock, HTTPS link, within budget) and removes duplicates.
  • Shopify Storefront API for book search and a one-item cart, created only after the shopper approves. ExchangeRate-API provides KES/USD rates; stale rates are rejected and USD estimates round up.
  • Zod validation for every request, tool input and external API response. Tested with Vitest and Playwright (86 unit and API tests passing).

Challenges I ran into

  • Budgets the model can't change. "Under $20" means $19.99 and "up to $20" means $20.00. A later limit replaces an earlier one, and numbers like "300 pages" are ignored. The limit is read from the shopper's messages and enforced on the server in every tool.
  • Two currencies. KES book prices against USD budgets, without a KES budget quietly becoming a USD one. Rounding USD up means a book never looks cheaper than it is.
  • Payment safety on serverless. Closed popups, dropped connections and double clicks must never become a double charge or a double commission.
  • Three different checkouts in one chat. A PayPal sandbox payment, a real Shopify checkout and a retailer link each needed clear, honest labels.

Accomplishments that I'm proud of

  • A complete purchase flow that a human approves: chat, a quote priced by the server, approval recorded on the server, PayPal capture, a receipt, and a commission in the merchant studio.
  • An agent that is useful but cannot spend money.
  • Real data on the live app: Channel3 retailer offers, a live Shopify catalog and a daily exchange rate.
  • Honest labels throughout: sandbox notices, real-money warnings and "checkout is at the retailer".

What I learned

Good agentic commerce depends more on what the agent can't do than on what it can. Narrow tools, checks on the server and a recorded approval step make an AI shopper trustworthy. PayPal Orders v2 already provides what an AI checkout needs: separate approve and capture steps, amounts that can be verified, and idempotency.

What's next for ShopiPal

  • PayPal webhooks for automatic reconciliation.
  • Multi-item carts, tax and shipping.
  • Real creator payouts using PayPal Payouts, built on the commission records.
  • A security review before taking live payments.

Built With

  • ag-grid
  • channel3
  • drizzle-orm
  • exchangerate-api
  • libsql
  • next.js
  • nextjs
  • openrouter
  • paypal
  • paypal-js-sdk
  • paypal-orders-api
  • react
  • shopify
  • shopify-storefront-api
  • turso
  • typescript
  • vercel
  • vercel-ai-sdk
  • zod
Share this project:

Updates

Submission history