Skip to content

Introducing npx agentic-payments: AP2 Reference Implementation with Visa TAP and QUIC Support #96

@ruvnet

Description

@ruvnet

I just released agentic-payments v0.1.5, a production-ready implementation of the Agent Payments Protocol (AP2) with full Model Context Protocol integration and Visa TAP support.

What is agentic-payments?

I built agentic-payments as the reference TypeScript implementation of AP2. The library enables AI agents to handle autonomous commerce with cryptographic authorization. Your AI shopping assistant can buy groceries. Your trading bot can execute stock purchases. Your business agents can approve invoices. All backed by Ed25519 signatures and multi-agent Byzantine consensus.

The core innovation is Active Mandates. These are cryptographically signed payment authorizations with spend caps, time windows, merchant restrictions, and instant revocation. An agent gets a mandate that says "spend max $500 per week at Whole Foods" and every transaction is verified against those constraints in under 3 milliseconds.

AP2 Protocol Implementation

I designed agentic-payments around four layers:

  1. Active Mandates: Autonomous payment capsules with spend caps, time windows, and instant revocation
  2. Agent Payments Protocol (AP2): Cryptographic payment mandates with Ed25519 signatures
  3. Agentic Commerce Protocol (ACP): REST API integration with Stripe-compatible checkout
  4. Model Context Protocol (MCP): Stdio and HTTP interfaces for AI assistant integration

The AP2 layer is the foundation. Every payment mandate gets an Ed25519 signature that proves authenticity. I implemented Byzantine fault-tolerant consensus so fleets of specialized agents (purchasing, finance, compliance, audit) can collaboratively authorize transactions. No single compromised agent can approve fraudulent payments.

MCP Integration for Conversational Commerce

AI assistants like Claude, ChatGPT, and Cline can create payment mandates, sign transactions, and verify consensus through natural language. No coding required. Just connect the MCP server with npx agentic-payments mcp and your AI assistant gains 10 payment tools:

  • Create Active Mandates with spend caps
  • Sign mandates with Ed25519
  • Verify signatures and execution guards
  • Revoke mandates instantly
  • Generate agent identities
  • Coordinate multi-agent consensus

This is conversational commerce. Your AI assistant understands "Create a weekly $500 mandate for grocery shopping" and handles all the cryptography.

Visa TAP: Enterprise Payment Standards

As a secondary feature in v0.1.5, I added support for Visa's Trusted Agent Protocol that dropped earlier this week. TAP brings QUIC transport integration from Agentic Flow.

Traditional TCP is like a single-lane highway. If one packet gets lost, everything behind it stops. QUIC runs over UDP and gives you multiple independent streams. Your AI agent can authorize a payment on stream one while simultaneously checking a signature on stream two and coordinating consensus on stream three. A hiccup in one stream does not freeze the
others.

QUIC encrypts everything by default with TLS 1.3. It supports 0-RTT resumption, so reconnections take under 1 millisecond instead of 200 milliseconds. Connection migration lets mobile agents switch networks mid-transaction without breaking the session.

The new VisaTapQuicTransport class handles QUIC connection management. I implemented RFC 9421 HTTP Message Signatures for cryptographic request signing. The core runs on Rust compiled to WebAssembly for maximum performance.

Real-World Applications

I see AP2 enabling:

  • E-Commerce: AI shopping agents with weekly budgets and merchant restrictions
  • Finance: Robo-advisors executing trades within risk-managed portfolios
  • Enterprise: Multi-agent swarms requiring consensus for high-value purchases
  • Accounting: Automated AP/AR with policy-based approval workflows
  • Subscriptions: Autonomous renewal management with spending caps

Get Started with AP2

Install with npm install agentic-payments. Run the MCP server with npx agentic-payments mcp. The whole package is under 200KB gzipped and works in Node.js, Deno, Bun, and browsers.

I built this as a complete reference implementation of AP2 with production-ready error handling, comprehensive TypeScript definitions, and full test coverage. The library demonstrates how cryptographic mandates, multi-agent consensus, and conversational AI interfaces come together to enable autonomous commerce.

See: https://www.npmjs.com/package/agentic-payments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions