SentinelPay — Trust Every Transaction. Control Every Agent.

Inspiration

AI shopping agents are becoming increasingly capable. They can search products, compare prices, make decisions, and potentially complete purchases on behalf of users. However, giving an autonomous AI agent direct access to payment credentials introduces a serious security problem: how can we trust an AI agent to spend our money safely?

We were inspired by the security challenges surrounding autonomous AI agents, particularly prompt injection, unauthorized purchases, hidden fees, unexpected subscriptions, and budget violations.

We wanted to explore a different approach: instead of trusting an AI agent with payment authority, what if we separated its ability to make shopping decisions from its ability to execute payments?

That idea became SentinelPay, a security gateway between AI shopping agents and PayPal. Our guiding principle is simple: the agent can propose a purchase, but the user retains control over the money.

What We Built

SentinelPay combines AI-powered shopping with deterministic security enforcement and cryptographic verification.

The system follows seven main steps:

  1. Intent Parsing: Google Gemini 3.1 Flash Lite converts natural-language shopping requests into structured spending mandates containing budget limits, permitted categories, quantity restrictions, recurring-payment rules, and expiration times.
  2. User Approval and Signing: The user reviews and approves the mandate, which is signed using Ed25519 cryptography.
  3. Autonomous Shopping: The shopping agent searches real products through the Channel3 Product Search API, compares prices and product information, and proposes a cart. It never receives PayPal credentials or payment tokens.
  4. Sentinel Policy Gate: A deterministic policy engine performs 11 security checks against the signed mandate. A separate prompt-injection firewall scans product content for hidden characters and malicious instructions.
  5. Proof of Intent: Approved purchases receive a cryptographically verifiable proof using canonical JSON, SHA-256 hashing, and Ed25519 signatures.
  6. PayPal Execution: The PayPal Server SDK communicates with the PayPal Orders API to create and capture payments in the Sandbox environment, but only after the policy gate approves the transaction.
  7. Audit Trail: Mandates, transactions, policy decisions, and proof records are stored in Turso Cloud SQLite.

We also developed a dashboard where users can manage spending policies, monitor transactions, review blocked purchases, handle human approvals, and inspect security audit logs.

How We Built It

We developed SentinelPay using Next.js 15, React 19, and Tailwind CSS v4.

Our technology stack includes:

  • Google Gemini 3.1 Flash Lite: Natural-language intent parsing and autonomous shopping assistance.
  • Vercel AI SDK: AI model integration and provider configuration.
  • PayPal Server SDK: PayPal Sandbox order creation and capture.
  • Channel3 Product Search API: Real product discovery and pricing information.
  • APIMatic ContextMatic: Accessing PayPal API specifications and understanding SDK types.
  • Node.js Native Crypto: Ed25519 signatures and SHA-256 hashing.
  • Turso Cloud SQLite: Persistent storage for mandates, transactions, audit logs, and proofs.
  • Drizzle ORM: Database operations.

A key architectural decision was keeping the policy enforcement independent of AI. Gemini helps interpret user intent and discover products, but it does not decide whether a payment is authorized. That decision belongs to our deterministic policy engine.

Challenges We Faced

One of our biggest challenges was designing a system that could use AI for flexibility without allowing AI-generated decisions to bypass security controls.

1. Separating AI Autonomy from Payment Authority

We needed the shopping agent to operate autonomously while ensuring it could never access payment credentials. We addressed this by separating the shopping agent from the PayPal execution module and allowing communication only through proposed shopping carts.

2. Enforcing User Intent Cryptographically

A spending mandate should not be silently modified after approval. We implemented Ed25519 signatures to validate mandates and used canonical JSON with SHA-256 hashing to generate verifiable Proof of Intent records.

3. Handling Prompt Injection

Product descriptions and merchant pages can contain hidden instructions designed to manipulate AI agents. We implemented a two-layer firewall involving invisible-character scanning and instruction scanning to identify suspicious content.

4. Building Deterministic Payment Controls

We implemented 11 policy checks covering mandate validity, signatures, product resolution, price integrity, spending limits, categories, quantities, subscriptions, additional fees, currency, and prompt injection. We also designed separate outcomes for automatic approval, human review, and immediate blocking.

5. Integrating Multiple Services

Connecting Gemini, Channel3, PayPal Sandbox, cryptographic operations, and persistent storage required careful coordination between application modules. We used APIMatic ContextMatic to help navigate PayPal API specifications and SDK types.

What We Learned

This project taught us that building reliable AI-powered financial systems requires more than integrating an AI model with a payment API.

We learned the importance of:

  • Applying Zero Trust principles to autonomous AI agents.
  • Separating AI-generated recommendations from security-critical authorization decisions.
  • Using cryptographic signatures to establish accountability and protect user-approved intent.
  • Treating external product content as untrusted input.
  • Designing human-in-the-loop controls for exceptional situations.
  • Maintaining verifiable audit trails for sensitive financial operations.
  • Integrating AI services with real payment infrastructure through secure backend architecture.

We also learned that security should be part of the architecture from the beginning, rather than something added after the core functionality is complete.

What's Next

SentinelPay is our exploration of a more secure foundation for agent-driven commerce. We want to extend its policy capabilities, strengthen defenses against increasingly sophisticated prompt-injection attacks, improve transaction verification, and explore broader integrations with agentic commerce protocols.

Our long-term vision is to make spending authority explicit, verifiable, and controlled by the user, regardless of how autonomous AI agents become.

SentinelPay — Trust Every Transaction. Control Every Agent.

Built With

Share this project:

Updates

Submission history