MandatePay AI — Secure Payments for AI Agents
Inspiration
AI agents are becoming capable of researching products, comparing options, and completing tasks on behalf of users. But what happens when an AI agent gets the ability to spend money?
Giving AI unrestricted purchasing authority creates concerns around overspending, unauthorized transactions, unreliable seller information, and accountability. We wanted to explore a different approach: what if AI could make purchasing decisions while users remained in control of their money?
That idea inspired MandatePay AI, a prototype designed to bring spending limits, human approval, and transaction transparency into AI-powered commerce.
What it does
MandatePay AI is an AI-assisted purchasing application that lets users describe what they need, set spending rules, compare product options, and proceed through PayPal Sandbox checkout.
Key features include:
- AI-powered recommendations: Interpret a purchase request and recommend products from a predefined catalog.
- Spending mandates: Configure a maximum budget, permitted category, and seller requirements.
- Policy enforcement: Block purchases that violate configured rules before creating a PayPal order.
- Human approval: Require users to review and approve checkout rather than allowing the AI to authorize its own payment.
- PayPal Sandbox integration: Create orders, open the PayPal approval page, and capture approved payments.
- Transaction audit trail: Record decisions and payment events in a hash-chained log, with a verification feature for detecting modifications to recorded events.
The application uses illustrative catalog data and seller indicators. These are demonstration signals, not independent verification of real merchants.
How we built it
We built MandatePay AI as a Python and Streamlit application with a dark, fintech-inspired interface.
The application separates AI-assisted recommendations from deterministic payment controls. The AI can help interpret requests and compare products, but it cannot override the application's spending rules.
The main workflow is:
- The user submits a purchase request and budget.
- The recommendation engine compares available catalog items.
- The policy engine checks the budget, category, seller indicator, and approval requirements.
- If the purchase satisfies the rules, the application can create a PayPal Sandbox order.
- The user approves checkout, and the backend captures the approved order.
- The application records the returned payment status and relevant audit events.
We integrated the PayPal Orders API for order creation and capture. OpenAI integration is optional; when configured, it provides structured product recommendations. A local recommendation fallback allows the application to run without an AI API key.
Challenges we faced
Separating AI reasoning from financial authority
An AI model should not decide whether its own payment is authorized. We addressed this by placing spending-rule checks in application logic outside the model.
Handling payment states correctly
Creating an order is not the same as completing a payment. The application distinguishes order creation, user approval, capture, and the returned payment status.
Making trust understandable
Users need more than a recommendation. They need to see why an option was selected, which mandate checks passed, and what happened to the payment.
Building a functional prototype within hackathon scope
We focused on a manageable end-to-end workflow with a small catalog, configurable spending controls, a PayPal Sandbox integration, and an audit interface rather than attempting unrestricted autonomous purchasing.
What we learned
This project helped us explore the practical challenges of agentic commerce, including structured AI outputs, API integration, payment lifecycle management, policy enforcement, and transaction traceability.
One of our most important takeaways was that safe financial autonomy requires more than a capable AI model. It requires clear permissions, deterministic controls, explicit user consent, and reliable payment-state verification.
What's next
Future improvements could include persistent database storage, verified PayPal webhook handling, stronger transaction idempotency, more sophisticated risk analysis, team approval workflows, and expanded purchasing scenarios.
Our long-term vision is to make delegated commerce more trustworthy by ensuring that AI agents can act only within clearly defined permissions.
Built for the PayPal + AI Hackathon
MandatePay AI explores a central question for the future of commerce:
How can we make AI-powered purchasing autonomous enough to be useful, but controlled enough to be trusted?
Log in or sign up for Devpost to join the conversation.