Inspiration :
As AI agents become increasingly capable of researching products, comparing prices, making decisions, and performing tasks autonomously, one important challenge remains: how can we allow AI agents to spend money without compromising user trust and financial control?
Traditional payment systems are designed primarily around human interactions. However, as AI moves towards autonomous commerce, there is a growing need for payment infrastructure that allows software agents to transact securely within clearly defined boundaries.
This inspired us to build AgentPay, an AI-powered financial safety layer that connects autonomous purchasing workflows with PayPal while ensuring that users remain in control of their money.
Our vision is simple: let AI agents handle purchasing tasks, but never let them operate beyond the financial permissions granted by their users.
What We Built :
AgentPay is a payment infrastructure designed for the emerging agentic economy. It enables AI-driven purchasing workflows while introducing a controlled execution layer between an autonomous agent and the payment system.
The platform focuses on three fundamental principles:
- Autonomy: AI agents can initiate purchasing workflows based on user instructions.
- Security: Backend validation and spending policies help prevent unauthorized or excessive transactions.
- User Control: Users retain authority over payment permissions, spending boundaries, and transaction approvals.
By combining AI-driven decision-making with PayPal's payment infrastructure, AgentPay aims to make autonomous commerce more secure, transparent, and accessible.
How We Built It :
We developed AgentPay using a modular, microservices-oriented architecture to separate application logic, payment processing, and shared configurations.
Our technology stack includes:
- Next.js: Application interface and user-facing workflows.
- TypeScript and Node.js: Type-safe application and backend development.
- PayPal Developer Platform: Integration with PayPal Sandbox for payment processing.
- PayPal OAuth 2.0: Secure application authentication and API access.
- PayPal Orders API v2: Creating orders, retrieving order details, and supporting buyer approval and payment workflows.
- Docker: Containerization and consistent development environments.
- GitHub Actions: Continuous integration and automated checks.
- Playwright: End-to-end testing of application workflows.
We implemented the PayPal integration using the Sandbox environment, allowing us to create and inspect test transactions without processing real payments.
We also structured the application around independently maintainable services, with an emphasis on separation of concerns, reusability, and secure backend execution.
Challenges We Faced :
One of our biggest challenges was integrating the PayPal payment lifecycle reliably.
Creating an order was only the beginning. We needed to understand OAuth authentication, order creation, buyer approval, payment status verification, and the handling of successful and cancelled checkout flows.
During testing, we encountered issues involving order retrieval, approval redirects, application routing, and Sandbox checkout behavior. These challenges required us to investigate API responses, inspect transaction states, validate redirect endpoints, and distinguish between application-level failures and payment-provider configuration issues.
Another challenge was designing a system where AI-driven purchasing decisions could coexist with deterministic financial safeguards. We believe that an autonomous agent should never be trusted with unrestricted payment authority.
We addressed this architectural challenge by treating payment execution and policy enforcement as separate responsibilities.
What We Learned :
Building AgentPay strengthened our understanding of:
- Integrating third-party financial APIs and OAuth authentication.
- Designing modular, containerized microservices.
- Managing asynchronous payment workflows and transaction states.
- Building reliable applications through automated testing and CI/CD.
- The importance of security, authorization, and spending controls in autonomous AI systems.
Most importantly, we learned that enabling autonomous AI transactions is not simply an AI problem or a payment integration problem. It requires both intelligent decision-making and a reliable financial control layer.
What's Next :
We envision AgentPay evolving into a broader financial infrastructure for the agentic economy, supporting multiple AI agents, configurable spending policies, transaction-level authorization, transparent audit trails, and more sophisticated risk controls.
Our long-term goal is to establish a model in which AI agents can act independently within boundaries defined by humans.
AgentPay is built around one fundamental belief: AI should be able to make purchasing decisions, but users should always remain in control of their money.
Built With
- docker
- docker-compose
- eslint
- fastify
- javascript
- next.js
- node.js
- paypal-developer-platform
- paypal-oauth-2.0
- paypal-rest-api-(orders-api-v2)
- playwright
- pnpm
- postgresql
- prettier
- typescript
- vitest
- zod