Inspiration
AI agents are already good at researching products, comparing options, and understanding user preferences. But the moment an agent needs to complete a transaction, the workflow breaks: checkout is designed for humans, consent is unclear, and post-purchase support starts from zero.
We built OPayAI to solve the missing layer between “I found the right product” and “I bought it safely.”
What it does
OPayAI is an agent-agnostic commerce and payment backbone exposed through MCP.
It enables any compatible agent or tool to:
- Discover structured offers with price, stock, delivery, compatibility, and return terms.
- Convert a user request into a signed intent mandate.
- Create a signed cart for a specific purchase.
- Deterministically validate budget, stock, currency, totals, spending limits, and user policies.
- Request approval or step-up authorization only when required.
- Execute a payment through pluggable mock payment adapters.
- Create and track an order.
- Handle cancellation and returns.
- Produce proactive notifications and a correlated audit event trail.
The complete flow is:
discover → decide → authorize → purchase → track → resolve
How we built it
We built OPayAI as a Python MCP server using FastMCP and Pydantic.
The architecture separates uncertain AI reasoning from deterministic transaction controls:
- The agent interprets the request and selects an offer.
- Ed25519-signed intent and cart mandates capture authorization.
- A fail-closed policy engine validates every transaction.
- Signed, expiring proofs represent approval and simulated trusted-surface step-up.
- Payment adapters expose a common interface for AP2-inspired and card flows.
- An order state machine manages payment, shipping, delivery, cancellation, and returns.
- A shared event bus powers the audit trail, status website, notifications, email, and webhooks.
The catalog and payment integrations are mocked, while the workflow, policy checks, signatures, authorization gates, and lifecycle transitions are executable and tested.
Challenges we ran into
The hardest challenge was defining where AI reasoning should stop and deterministic payment logic should begin.
We also had to address:
- Preventing an agent from bypassing approval and spending rules.
- Binding authorization to an exact cart, amount, currency, and expiration time.
- Revalidating stock and policy immediately before payment.
- Preventing duplicate payments during concurrent execution.
- Preserving the merchant’s original return terms with the order.
- Representing proactive user intervention without interrupting every purchase.
- Keeping the architecture general enough for any MCP-compatible agent.
- Clearly separating our AP2-inspired model from full AP2 protocol compliance.
Accomplishments that we're proud of
We are especially proud that OPayAI is more than a shopping chatbot or product recommendation demo.
It provides:
- A complete prompt-to-order transaction workflow.
- Signed intent and cart mandates.
- Deterministic, explainable, fail-closed policy decisions.
- Automatic approval and step-up gates based on standing user policies.
- Signed and expiring authorization evidence.
- In-process idempotency and concurrency protection.
- Proactive notifications through desktop, email, and webhook channels.
- Order tracking, cancellation, and returns.
- A live status page and correlated audit event trail.
- An agent-agnostic MCP interface with 14 tools.
- A comprehensive automated test suite covering happy paths and failure scenarios.
What we learned
We learned that agentic commerce is primarily a trust and infrastructure problem—not a recommendation problem.
A capable agent is not enough. Safe transactions require:
- Explicit and verifiable delegated authority.
- Deterministic controls outside the LLM.
- Authorization bound to the exact transaction.
- Clear escalation rules.
- Idempotent payment execution.
- Durable transaction and order state.
- Post-purchase workflows from the beginning.
- Honest boundaries between prototypes, mocks, and protocol-compliant integrations.
We also learned that the best agent experience is often invisible: the user should be interrupted only when a decision or authorization is genuinely required.
What’s next for OPayAI
Our next steps are:
- Replace the mock adapter with a real PSP integration.
- Implement the official AP2 Checkout and Payment Mandate schemas.
- Add a real WebAuthn trusted surface for user-present authorization.
- Move transaction state to durable database storage.
- Add crash-safe PSP idempotency and payment reconciliation.
- Support authorization, capture, void, refund, and partial refund operations.
- Sign webhooks and introduce durable delivery retries.
- Add merchant integrations for live offers, inventory, checkout, and fulfillment.
- Expand user policies with merchant, category, velocity, and risk controls.
- Package OPayAI as a reusable commerce infrastructure layer for any agent, assistant, or automation platform.


Log in or sign up for Devpost to join the conversation.