Inspiration

Agents are getting good at choosing what to buy, and that makes the payment step matter more. People don't want an agent that spends for them. They want one that does the legwork and hands them a ready, correct order to approve. Skincare is a good test: the right products depend on your actual skin, and most people buy the wrong ones.

What it does

Glow Agent turns one selfie into a paid order in a single conversation:

  1. Skin analysis. YouCam AI scores 11 concerns, maps them on your face, and reads skin type and skin age.
  2. A routine. Glow builds a morning and night routine from your scores, and can fit it to a budget.
  3. Try-on. You compare makeup shades rendered on your own photo.
  4. Bag. Glow adds the items you choose, with shades and quantities.
  5. PayPal checkout. Glow opens checkout, and you approve the payment in PayPal.

How PayPal is used

  • Server-side Orders v2. POST /v2/checkout/orders (intent CAPTURE) creates an itemized order whose item_total matches the amount. POST /v2/checkout/orders/{id}/capture captures it after approval. The capture result (status, amount, payer first name) drives the confirmation screen.
  • Prices come from the server. The browser and the agent only say which products and how many. The Worker rebuilds the bag and prices every line from its own catalog, so neither a prompt nor a client can change a price.
  • JavaScript SDK v6. createInstance, findEligibleMethods, createPayPalOneTimePaymentSession and <paypal-button>, with onApprove, onCancel and onError handled in the UI.
  • The human stays in charge. The agent's start_checkout tool only opens the PayPal button. It can't create a capture or pay. The user approves in PayPal's own window.
  • Sandbox only. No real money moves.

How AI is used

Gemini runs Glow's tool loop, and its answers are grounded in the user's scores. YouCam's vision models produce the skin report and the try-on renders. A deterministic recommender gives the agent a grounded starting point, and the app keeps working (button flows) if the free-tier model is busy.

How I built it

  • Hosting: one Cloudflare Worker serves the static app and the API, with daily per-visitor quotas in KV.
  • Tests: 48 vitest unit tests cover the agent loop, PayPal cart pricing and order body, and the routes.
  • Verified end to end: a sandbox payment through the deployed flow was captured with status COMPLETED.
  • AI coding assistant: built with help from Claude Code.

Challenges

  • Keeping the agent useful without letting it spend. The fix was splitting "fill the bag and open checkout" (agent) from "approve and capture" (user plus server).
  • Small free-tier models sometimes misreport what a tool did. Server-side checks keep replies accurate.

What's next

  • Reorders: a saved PayPal payment method (Vault) for one-tap restocks the user approves once.
  • Refills: subscription refills for products that run out on a schedule.
  • Order history: "what did I buy last time" from PayPal transaction history, so the agent knows what's running low.

Notes: demo data uses YouCam's sample face, and the shop's products are fictional. Cosmetic guidance, not medical advice.

Built With

Share this project:

Updates

Submission history