Inspiration
AgentPay started with a frustration from my own life: buying one product can turn into hours of browsing.
I open multiple tabs, compare prices, read reviews, and keep searching because there might be a better deal somewhere else. I want something affordable that meets my needs, but finding the βcheap and bestβ option often takes more time than the purchase deserves.
I wanted to bring that wasted time as close to zero as possible. What if I could simply say, βFind a power bank with at least 20,000 mAh capacity for under $50,β and let an AI agent handle the work?
But letting AI spend money introduces a bigger question: How do I give an agent purchasing power while keeping control over my money? That became the idea behind AgentPay.
What AgentPay Does
AgentPay turns natural-language purchase instructions into a spending mandate. The agent estimates a price range, identifies the product category, searches for a suitable option, and checks the proposed purchase against the mandate.
Before payment starts, the interface shows the product and price in a confirmation popup. Users can continue or cancel; without a response, the purchase proceeds automatically after ten seconds.
Payments follow PayPalβs authorize β capture lifecycle. With automatic capture disabled, execution stops at authorization for review. A rejected policy stops the mandate and blocks further payment attempts.
How I Built It
I built the interface with Next.js, React, and Tailwind CSS, and used FastAPI to coordinate the agents, policy checks, and payment lifecycle.
Cloudflare Workers AI powers the pricing, category, and shopping agents. Supabase stores authentication data, mandates, and audit events. The PayPal SDK provides saved payment methods, authorization, capture, and void operations.
The agent works with a reference to a saved payment method instead of receiving card numbers or PayPal passwords.
The current prototype searches a demo product catalog. Its price estimates come from the AI model rather than live market quotes.
What I Learned
The biggest lesson was that finding a product and safely buying it are two very different problems.
AI can interpret a request and propose a purchase, but the backend needs to enforce the spending rules and control payment execution. A prompt alone is not enough.
I also learned how important visibility is. Showing the estimated price range, decision reasoning, purchase status, and audit history makes an autonomous workflow easier to understand and trust.
Challenges I Faced
The hardest part was coordinating decisions and payments when several things could happen at once: the agent might be executing, the user might cancel, or a payment response might be delayed.
I had to account for duplicate payment attempts, uncertain outcomes, and cancellations that arrive during execution. Another challenge was making policy rejection final, so the agent could not keep trying different arguments after a purchase had been rejected.
Whatβs Next
My next step is connecting live merchant search so AgentPay can compare real products, prices, and availability.
The goal is personal and simple: spend less time shopping for the right product, without giving up control over the purchase.
Built With
- cloudflare
- codex
- fastapi
- next.js
- python
- supabase