Inspiration
As AI agents become capable of making purchases and executing financial transactions, a critical question emerges: Who controls the money when an AI agent acts autonomously?
An AI agent can misunderstand user instructions, exceed spending limits, or encounter malicious prompt injections. Traditional payment authorization alone does not necessarily verify whether an AI agent's proposed purchase matches the user's original intent.
We built AgentPay Sentinel to address this challenge: a Zero-Trust Security Gateway that ensures AI-assisted payments remain governed by explicit, verifiable user authorization.
What It Does
AgentPay Sentinel acts as a security enforcement layer between AI agents and PayPal payment execution.
Before a payment can proceed, the system validates a cryptographically bound purchase intent, checks deterministic security policies, and optionally analyzes transaction risk using AI.
Our core principle: AI can analyze risk, but it cannot override financial authorization.
Key capabilities include:
- Zero-Trust Purchase Intents: Verify authorized merchants, amounts, currencies, expiration, and transaction details using HMAC-SHA256 fingerprints.
- Deterministic Policy Engine: Enforce payment rules independently of AI predictions.
- AI Threat Intelligence: Use Groq-powered LLM analysis to identify suspicious behavior and potential manipulation.
- PayPal Sandbox Integration: Create PayPal Orders v2, verify buyer approval, execute authorized captures, and validate webhook signatures.
- Secure Payment Lifecycle: Enforce state transitions, transaction binding, idempotency, and duplicate-capture protection.
- Adversarial Security Lab: Evaluate the gateway against simulated security attacks.
- Security Command Center: Monitor purchase intents, transactions, payments, threat intelligence, and audit evidence through a web dashboard.
How We Built It
We developed AgentPay Sentinel using a modern full-stack architecture.
Frontend: Next.js, React, TypeScript, and Tailwind CSS.
Backend: Python, FastAPI, SQLAlchemy, and SQLite.
AI: Groq API with the openai/gpt-oss-120b model for advisory threat analysis.
Payments: PayPal Sandbox Orders v2 API, OAuth authentication, and verified webhooks.
Security: HMAC-SHA256, deterministic transaction authorization, signed operator sessions, CSRF protection, strict state validation, and replay-resistant payment processing.
A transaction progresses through purchase-intent verification, deterministic policy evaluation, AI risk analysis, PayPal order creation, buyer approval, and authorized capture.
The PayPal order's custom_id is strictly validated against the internal transaction identifier to prevent incorrect transaction binding.
Challenges We Faced
One of our biggest challenges was integrating an autonomous AI workflow with secure financial authorization without giving the AI model control over payment decisions.
We also addressed:
- Preventing prompt-injection and AI-analysis outputs from bypassing deterministic policies.
- Preserving exact transaction binding across internal records and PayPal Orders.
- Handling asynchronous buyer approvals and webhook events safely.
- Preventing duplicate captures and unsafe retries.
- Designing fail-closed behavior for ambiguous external payment outcomes.
- Building a responsive security dashboard with reliable audit evidence and authentication.
Accomplishments We're Proud Of
1. Real PayPal Sandbox transaction completed
We successfully executed a $5.00 USD Sandbox payment through the protected workflow, including purchase-intent verification, buyer approval, and confirmed PayPal capture.
2. Adversarial security validation
Our offline security harness successfully passed 52 out of 52 scenarios across 10 attack categories, verifying all 14 security invariants.
3. Automated regression testing
Our final QA achieved:
- 424 backend tests passed, with 4 skipped.
- 46 frontend tests passed.
- Successful TypeScript compilation and production build.
4. Independent authorization enforcement
Our AI risk-analysis layer cannot independently approve payments or override deterministic security decisions.
What We Learned
This project reinforced that integrating AI into financial systems requires more than intelligent decision-making. It requires explicit authorization boundaries, cryptographic integrity, deterministic controls, carefully validated external integrations, and auditable execution.
We also gained practical experience with PayPal Sandbox, asynchronous payment lifecycles, secure API development, adversarial testing, and fail-closed system design.
What's Next
AgentPay Sentinel is currently a functional localhost-only PayPal Sandbox prototype.
Our future roadmap includes multi-user authorization, stronger session management, production-grade observability, isolated adversarial execution, and expanded AI-agent ecosystem integrations.
Our vision is simple: make autonomous AI commerce secure, verifiable, and accountable.
AgentPay Sentinel is an independent hackathon project and is not an official PayPal product.
Built With
- fastapi
- gpt-oss-120b
- groq
- hmac-sha256
- next.js
- oauth-2.0
- paypal-rest-apis
- paypal-sandbox
- python
- react
- sqlalchemy
- sqlite
- tailwind-css
- typescript
- vitest