PAYMENTS

Agent Payments: AP2, Stripe MPP, and x402 Protocols

The definitive guide to how AI agents pay for things. Covers Google AP2 mandates with 60+ partners, Stripe Machine Payments Protocol (MPP) for session-based fiat and stablecoin payments, x402 for HTTP-native USDC micropayments on Base, signing payment intents with the Claude Agent SDK, merchant-side verification, risk and fraud handling, PCI DSS and PSD2 compliance, AP2 + A2A integration for agent-to-agent payment delegation, and a complete end-to-end tutorial for building payment-capable agents.

1. Why Agents Need Payment Protocols

Traditional payment flows assume a human clicking buttons: selecting items, filling in card details, reviewing a total, and pressing "Pay". AI agents operate differently. They execute tasks autonomously, often when the user is asleep or unavailable, across dozens of services in a single workflow. An agent booking a flight, reserving a hotel, and renting a car needs to make three separate payments to three different merchants without any human-in-the-loop confirmation at each step. Existing checkout pages, CAPTCHAs, and cookie-consent banners are designed to verify human presence -- they actively prevent machine-initiated transactions.

The fundamental gap is authorization delegation. A human must be able to grant an agent a scoped, auditable, time-limited permission to spend money on their behalf -- with clear limits on what, how much, and with whom. Without a standardized protocol for this, every agent-merchant pair would need a bespoke integration, creating an N-times-M interoperability problem identical to the one REST APIs faced before OpenAPI. Three protocols have emerged to solve this: Google AP2 (mandate-based authorization), Stripe MPP (session-based streaming payments), and x402 (HTTP-native stablecoin micropayments).

The stakes are significant. By 2026, agentic commerce is projected to handle billions in transaction volume as AI agents move from research assistants to autonomous economic actors. The protocols covered in this guide define the trust, authorization, and settlement layers that make this possible.

2. Google AP2: The Mandate Model

The Agent Payments Protocol (AP2), announced by Google on April 3, 2026, is an open protocol for securing agent-led payments across platforms. AP2 launched with over 60 partners including Mastercard, PayPal, Adyen, Coinbase, American Express, Revolut, UnionPay International, Worldpay, Etsy, Intuit, JCB, Mysten Labs, Salesforce, ServiceNow, and Forter. The protocol is payment-agnostic -- it supports traditional cards, bank transfers, alternative payment methods, and stablecoins via its x402 extension.

The centerpiece of AP2 is its mandate architecture, built on Verifiable Credentials (VCs) -- cryptographically signed digital contracts that define exactly what an AI agent is permitted to do on the user's behalf. Mandates are tamper-evident, machine-readable, and cryptographically bound to both the user's identity and the agent's identity. They serve as the authorization layer between the human (who approves) and the agent (who executes).

Three Mandate Types

  • Cart Mandate: Used when the user is present during the transaction. The merchant generates a cart, the agent fills it based on user instructions, and the user cryptographically signs the mandate using a hardware-backed key on their device with in-session authentication. Think "Find me an electric razor under $100" -- the agent shops, but you approve before money moves
  • Intent Mandate: Used when the user is not present at transaction time. The human pre-authorizes a spending scope (amount ceiling, merchant category, time window), and the agent executes autonomously within those bounds. Think "Restock office supplies when inventory drops below threshold, max $500/month." The agent transacts without real-time human approval, but the mandate constrains its authority
  • Payment Mandate: A separate verifiable digital credential bound to a Cart or Intent mandate but containing payment-specific information. It is shared with the payments ecosystem (processors, card networks, banks) to authorize the actual fund movement. This separation ensures the payment layer only sees the minimum data required for settlement
// AP2 Cart Mandate structure (simplified)
{
  "@context": ["https://www.w3.org/2018/credentials/v1", "https://ap2-protocol.org/v1"],
  "type": ["VerifiableCredential", "CartMandate"],
  "issuer": "did:key:z6Mkuser...",           // User's DID
  "credentialSubject": {
    "agent": "did:key:z6MkagentClaude...",   // Agent's DID
    "merchant": "did:web:shop.example.com",
    "cart": {
      "items": [{"sku": "RAZOR-X100", "qty": 1, "maxPrice": {"amount": 10000, "currency": "USD"}}],
      "maxTotal": {"amount": 10000, "currency": "USD"}
    },
    "validUntil": "2026-04-16T23:59:59Z"
  },
  "proof": {
    "type": "Ed25519Signature2020",
    "verificationMethod": "did:key:z6Mkuser...#key-1",
    "proofPurpose": "assertionMethod",
    "created": "2026-04-16T10:00:00Z"
  }
}

3. Stripe Machine Payments Protocol (MPP)

Stripe launched the Machine Payments Protocol (MPP) on March 18, 2026, co-authored with Tempo. MPP is an open, internet-native standard for agent-to-service payments. While AP2 defines the authorization layer (who is allowed to pay), MPP defines the payment execution layer (how the money actually moves). MPP builds on Stripe's existing infrastructure -- Payment Intents, Radar fraud detection, tax calculation, and compliance stack -- making it immediately production-ready for businesses already on Stripe.

The core mental model: when an agent requests a paid resource, the server returns an HTTP 402 Payment Required response containing payment details (amount, currency, accepted methods, Stripe payment intent ID). The agent authorizes using a Shared Payment Token (SPT), retries the request with the token, and receives the resource along with a receipt. SPTs support fiat (cards, buy-now-pay-later) and stablecoins, making MPP a hybrid protocol that bridges traditional and crypto payment rails.

MPP Request Flow

  • Step 1 -- Discovery: Agent sends GET /api/resource to the merchant server
  • Step 2 -- 402 Response: Server returns HTTP 402 with X-Payment-Details header containing amount, currency, Stripe payment intent client secret, and accepted payment methods
  • Step 3 -- Authorization: Agent creates or retrieves a Shared Payment Token (SPT) via Stripe API, scoped to the specific payment intent
  • Step 4 -- Payment: Agent retries the original request with X-Payment-Token: spt_... header. Stripe settles the payment
  • Step 5 -- Fulfillment: Server verifies the SPT with Stripe, delivers the resource, and returns an X-Payment-Receipt header with the transaction ID
// Merchant server: MPP-enabled endpoint (Node.js + Express)
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);

app.get('/api/browser-session', async (req, res) => {
  const spt = req.headers['x-payment-token'];

  if (!spt) {
    // Step 2: Return 402 with payment details
    const pi = await stripe.paymentIntents.create({
      amount: 50, currency: 'usd',  // $0.50 per session
      metadata: { type: 'browser_session', agent: req.headers['x-agent-id'] }
    });
    return res.status(402).json({
      payment_intent: pi.client_secret,
      amount: 50,
      currency: 'usd',
      methods: ['card', 'spt', 'x402']
    });
  }

  // Step 5: Verify SPT and fulfill
  const verified = await stripe.paymentTokens.verify(spt);
  if (verified.status === 'succeeded') {
    const session = await createBrowserSession();
    res.set('X-Payment-Receipt', verified.payment_intent);
    return res.json({ session_id: session.id, ws_url: session.wsUrl });
  }
  res.status(402).json({ error: 'payment_failed' });
});
MPP is ideal for high-frequency agent sessions -- API calls, compute minutes, browser sessions -- where Stripe's built-in fraud detection, tax handling, and PCI compliance eliminate the need for custom security infrastructure. Real-world adopters include Browserbase (headless browsers, pay-per-session), PostalForm (agents printing and mailing physical documents), and Prospect Butcher Co. (agents ordering food for human pickup).

4. x402 Protocol

x402 is an open payment protocol created by Coinbase that enables instant, automatic payments directly over HTTP. It revives the long-dormant HTTP 402 ("Payment Required") status code, which was reserved in the HTTP/1.1 specification in 1997 but never standardized -- until now. The protocol is Apache 2.0 licensed and governed by the x402 Foundation under the Linux Foundation, which was formally established on April 2, 2026 with founding members Google, AWS, Microsoft, Cloudflare, Stripe, Visa, and Mastercard.

The flow is elegantly simple. A client (AI agent or app) requests a paid resource. The server returns a 402 Payment Required response with payment details (price, acceptable tokens, recipient address). The client signs a payment payload using its wallet private key and resends the request with the signed payload in an HTTP header. The Coinbase x402 Facilitator verifies and settles the payment onchain, and the server delivers the resource. The entire exchange settles in under 2 seconds with transaction costs of approximately $0.0001 on Base. x402 v2, shipped in January 2026, introduced wallet-based identity, multi-chain and fiat support via CAIP (Chain Agnostic Improvement Proposals), and dynamic recipients for split payments and marketplace scenarios.

The Coinbase Developer Platform (CDP) provides a hosted facilitator service that processes payments on Base, Polygon, Solana, and Etherlink (added March 2026) with a free tier of 1,000 transactions per month. USDT support was added in April 2026 via a Utexo partnership, complementing USDC as the second supported stablecoin. Since its release in May 2025, x402 has processed over 200 million transactions worth $85 million for paid APIs and AI agents through April 2026. Visa launched Visa CLI, integrating wallet-based payments with MPP. Cloudflare integrated x402 natively, allowing any Cloudflare Worker to become a paid API with a few lines of configuration.

Protocol Comparison

AP2Stripe MPPx402
FocusAuthorization mandatesPayment executionMicropayments
Payment RailsCards, bank, stablecoinFiat + stablecoin (SPT)USDC, USDT, fiat via CAIP
SettlementVia payment processorStripe (instant)Onchain (<2s)
Tx CostVaries by processorStripe fees (2.9%+30c)~$0.0001 on Base
Ideal ForDelegated purchasingHigh-frequency sessionsPer-request API calls
Auth ModelVerifiable CredentialsStripe API keys + SPTWallet signature
// x402 client: AI agent paying for API access
import { createWalletClient, http } from 'viem';
import { base } from 'viem/chains';
import { privateKeyToAccount } from 'viem/accounts';

const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const wallet = createWalletClient({ account, chain: base, transport: http() });

async function callPaidAPI(url) {
  // Step 1: Request the resource
  const res = await fetch(url);
  if (res.status !== 402) return res.json();

  // Step 2: Parse payment details from 402 response
  const paymentDetails = JSON.parse(res.headers.get('X-Payment-Details'));
  // { amount: "100000", token: "USDC", recipient: "0xmerchant...", network: "base" }

  // Step 3: Sign the payment payload
  const payload = {
    amount: paymentDetails.amount,
    token: paymentDetails.token,
    recipient: paymentDetails.recipient,
    nonce: Date.now().toString()
  };
  const signature = await wallet.signMessage({ message: JSON.stringify(payload) });

  // Step 4: Retry with payment
  const paidRes = await fetch(url, {
    headers: {
      'X-Payment': JSON.stringify({ ...payload, signature }),
      'X-Payment-Protocol': 'x402'
    }
  });
  // X-Payment-Response header confirms settlement
  return paidRes.json();
}

5. Signing a Payment Intent with Claude Agent SDK

The Claude Agent SDK enables building agents that can interact with payment protocols through tool use. The agent does not hold funds or private keys directly -- instead, it delegates payment operations to tools that interface with secure payment infrastructure. This follows the principle of least privilege: the agent reasons about what to buy, the payment tool handles the cryptographic signing and fund movement.

In practice, you define payment tools that the agent can invoke. For Stripe MPP, the tool creates a Payment Intent and returns the SPT. For x402, the tool signs a payment payload using a wallet key stored in a secure enclave or key management service. For AP2, the tool generates a mandate request and presents it to the user for signing (Cart Mandate) or validates it against a pre-authorized Intent Mandate.

// Claude Agent SDK: Payment-capable agent with MPP tool
import Anthropic from '@anthropic-ai/sdk';
import Stripe from 'stripe';

const anthropic = new Anthropic();
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);

const paymentTools = [{
  name: 'pay_with_mpp',
  description: 'Pay for a resource using Stripe MPP. Returns a Shared Payment Token.',
  input_schema: {
    type: 'object',
    properties: {
      payment_intent_secret: { type: 'string', description: 'The client_secret from the 402 response' },
      payment_method: { type: 'string', description: 'Payment method ID (pm_...)' }
    },
    required: ['payment_intent_secret', 'payment_method']
  }
}, {
  name: 'pay_with_x402',
  description: 'Pay for a resource using x402 USDC on Base. Signs and submits payment.',
  input_schema: {
    type: 'object',
    properties: {
      amount: { type: 'string', description: 'Amount in USDC smallest unit' },
      recipient: { type: 'string', description: 'Recipient wallet address' }
    },
    required: ['amount', 'recipient']
  }
}];

// Agent loop
async function runPaymentAgent(task) {
  let messages = [{ role: 'user', content: task }];

  while (true) {
    const response = await anthropic.messages.create({
      model: 'claude-sonnet-4-20250514',
      max_tokens: 4096,
      tools: paymentTools,
      messages
    });

    if (response.stop_reason === 'tool_use') {
      const toolCall = response.content.find(b => b.type === 'tool_use');

      let result;
      if (toolCall.name === 'pay_with_mpp') {
        const pi = await stripe.paymentIntents.confirm(
          toolCall.input.payment_intent_secret.split('_secret_')[0],
          { payment_method: toolCall.input.payment_method }
        );
        result = { status: pi.status, receipt: pi.id };
      }
      // ... handle other payment tools

      messages.push({ role: 'assistant', content: response.content });
      messages.push({ role: 'user', content: [{
        type: 'tool_result', tool_use_id: toolCall.id,
        content: JSON.stringify(result)
      }]});
      continue;
    }
    return response.content[0].text;
  }
}
Never store wallet private keys or Stripe secret keys in the agent's context or prompts. Use environment variables, secret managers (AWS Secrets Manager, HashiCorp Vault, 1Password), or hardware security modules (HSMs). The agent should only receive opaque tokens and transaction receipts, never raw credentials.

6. Merchant-Side Verification Flow

Merchants receiving agent payments must verify three things: (1) the payment was authorized by a real human (or a valid pre-authorization), (2) the payment settled successfully, and (3) the requesting agent is who it claims to be. Each protocol handles verification differently.

AP2 Verification

  • Mandate validation: Verify the VC signature using the issuer's public DID. Check that the mandate has not expired (validUntil), covers the requested items and amount, and names the presenting agent
  • Payment Mandate: Forward the Payment Mandate to your payment processor. The processor validates it against the card network and settles funds
  • Agent identity: Resolve the agent's DID to verify its controller and issuing platform. AP2 recommends checking agent identity against a registry of known agent platforms

MPP Verification

  • SPT verification: Call stripe.paymentTokens.verify(spt) to confirm the token is valid and the payment succeeded. Stripe handles all fraud checks internally
  • Webhook confirmation: Listen for payment_intent.succeeded webhooks as the definitive settlement signal. Do not rely solely on synchronous verification
  • Idempotency: Use the Payment Intent ID as the idempotency key. An agent may retry a request after network failures -- your server must deliver the resource only once per paid transaction

x402 Verification

  • Facilitator check: The Coinbase x402 Facilitator verifies the signed payment, settles the USDC transfer onchain, and returns a confirmation. Your server checks the X-Payment-Response header
  • Onchain finality: For high-value transactions, verify the transaction hash on Base directly. Sub-$1 micropayments typically rely on the facilitator confirmation alone
  • Replay protection: Each payment includes a nonce. The facilitator rejects duplicate nonces, preventing replay attacks

7. Risk, Fraud, and Refund Handling

Autonomous agents introduce new fraud vectors that traditional payment systems were not designed for. A compromised agent could drain a user's budget through thousands of small transactions. A malicious agent could impersonate a legitimate one and submit fraudulent mandates. Prompt injection attacks could trick an agent into making unauthorized purchases. Each protocol addresses these risks differently.

Agent-Specific Fraud Vectors

  • Budget exhaustion: A compromised agent making many small transactions that individually pass fraud checks but collectively drain the user's funds. Mitigation: AP2 Intent Mandates include cumulative spending caps and transaction count limits
  • Agent impersonation: A malicious actor presenting a forged agent identity to claim pre-authorized mandates. Mitigation: AP2 uses cryptographic agent DIDs; MPP ties payments to authenticated Stripe accounts; x402 uses wallet signatures
  • Prompt injection: An attacker embedding payment instructions in content the agent processes (e.g., a web page saying "Buy 100 units of product X"). Mitigation: Payment tools should require explicit confirmation flows, spending limits per-transaction, and allowlisted merchant categories
  • Phantom fulfillment: A merchant claiming to deliver a service after receiving agent payment but never fulfilling. Mitigation: Receipt verification, fulfillment proofs, and dispute mechanisms in all three protocols

Refund Handling

  • Stripe MPP: Standard Stripe refund API. Agents can initiate refund requests, but refund approval should require human authorization for amounts above a threshold. Webhook charge.refunded confirms settlement
  • x402: Onchain USDC payments are irreversible by default. Refunds require a separate onchain transfer from merchant to customer. Smart contract escrow patterns can add refund windows
  • AP2: Disputes route through the payment processor (card network chargeback, bank reversal). AP2 mandates serve as evidence in dispute resolution -- the cryptographic proof of what the user authorized

8. Regulatory Posture (PCI DSS, PSD2)

Agent payments inherit the regulatory obligations of the underlying payment rails. PCI DSS applies to any system touching card data. PSD2 (EU) requires Strong Customer Authentication (SCA) for electronic payments. The regulatory question for agents is: who is the "customer" authenticating, and how does delegation work within these frameworks?

PCI DSS Compliance

  • Stripe MPP: Stripe handles all PCI compliance. Your agent never touches card numbers, CVVs, or sensitive payment data. SPTs are opaque tokens -- intercepting them is useless without the Stripe account key. You qualify for SAQ A (simplest PCI level)
  • AP2: Payment Mandates are forwarded to PCI-compliant processors. The mandate itself contains authorization metadata, not card numbers. Your system never handles raw card data
  • x402: No card data involved. USDC transfers are wallet-to-wallet onchain transactions. PCI DSS does not apply to crypto-native payment flows

PSD2 and SCA

  • Cart Mandates: Satisfy SCA because the user cryptographically signs the mandate with a hardware-backed key (possession factor) and biometric or PIN authentication (inherence/knowledge factor) at transaction time
  • Intent Mandates: Operate similarly to pre-authorized recurring payments under PSD2. The initial mandate creation satisfies SCA. Subsequent agent transactions within the mandate scope are treated as merchant-initiated transactions (MITs), which are exempt from SCA
  • MPP transactions: Stripe handles SCA challenges automatically. If 3D Secure is required, the agent can present the challenge to the user via the Claude Agent SDK elicitation mechanism or fall back to pre-authorized payment methods
Regulatory frameworks for autonomous agent payments are evolving rapidly. The EU AI Act, US state money transmission laws, and regional e-money regulations may impose additional requirements on agent payment intermediaries. Consult legal counsel for your specific jurisdiction before deploying agent payment flows in production.

9. AP2 + A2A Integration

AP2 was designed to work as an extension of Google's Agent-to-Agent (A2A) protocol. In A2A, agents discover each other via Agent Cards, exchange tasks, and collaborate through standardized message formats. AP2 adds a payment layer to this: when Agent A delegates a purchasing task to Agent B (a specialized shopping agent), Agent B needs payment authority to execute the transaction. AP2 mandates provide exactly this -- a scoped, verifiable authorization that travels with the task delegation.

The integration works through the AP2 Mandates Extension for A2A (specification version 2026-01-11). When an A2A task involves a payment, the delegating agent attaches an Intent Mandate to the task payload. The receiving agent validates the mandate, executes the purchase within its bounds, and returns the receipt as part of the task completion. This enables multi-agent supply chains: a procurement agent discovers a vendor agent via A2A, negotiates terms, and delegates the actual purchase to a payment agent -- all with cryptographic authorization flowing through each step.

// A2A task with AP2 payment delegation
{
  "jsonrpc": "2.0",
  "method": "tasks/send",
  "params": {
    "id": "task_purchase_supplies",
    "message": {
      "role": "user",
      "parts": [{
        "type": "text",
        "text": "Purchase 50 boxes of A4 paper from approved vendor"
      }]
    },
    "extensions": {
      "ap2": {
        "mandate": {
          "type": "IntentMandate",
          "scope": {
            "merchantCategory": "office_supplies",
            "maxAmount": {"amount": 50000, "currency": "USD"},
            "validUntil": "2026-04-17T00:00:00Z"
          },
          "credential": "eyJhbGciOiJFZERTQSIs..."  // Signed VC (base64)
        }
      }
    }
  }
}
AP2 + A2A enables enterprise workflows like: procurement agent detects low inventory, vendor-selection agent negotiates with 3 supplier agents via A2A, purchasing agent executes the best deal using an AP2 Intent Mandate, and accounting agent records the transaction -- all autonomous, all auditable, all cryptographically authorized.

10. Building a Payment-Capable Agent: End-to-End Tutorial

This tutorial builds a Claude Agent SDK agent that can browse products, compare prices, and pay using either Stripe MPP or x402 depending on the merchant's supported protocols. The agent respects a spending budget, logs all transactions, and requests human approval for purchases above a threshold.

Prerequisites

  • Node.js 20+ with TypeScript
  • Stripe account with MPP enabled (request access via Stripe Dashboard)
  • Coinbase Developer Platform account for x402 facilitator
  • USDC on Base testnet (get from Base Sepolia faucet)
  • Anthropic API key for Claude Agent SDK
// Full payment agent: MPP + x402 dual-protocol support
import Anthropic from '@anthropic-ai/sdk';
import Stripe from 'stripe';
import { createWalletClient, http, parseUnits } from 'viem';
import { baseSepolia } from 'viem/chains';
import { privateKeyToAccount } from 'viem/accounts';

const anthropic = new Anthropic();
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
const wallet = createWalletClient({
  account: privateKeyToAccount(process.env.AGENT_WALLET_KEY),
  chain: baseSepolia,
  transport: http()
});

// Budget tracker
const budget = { maxUsd: 100_00, spentUsd: 0, txCount: 0, maxPerTx: 25_00 };
const txLog = [];

const tools = [
  {
    name: 'check_budget',
    description: 'Check remaining budget and transaction history',
    input_schema: { type: 'object', properties: {} }
  },
  {
    name: 'pay_mpp',
    description: 'Pay via Stripe MPP. Use when merchant returns 402 with Stripe payment intent.',
    input_schema: {
      type: 'object',
      properties: {
        merchant_url: { type: 'string' },
        amount_cents: { type: 'number' },
        description: { type: 'string' }
      },
      required: ['merchant_url', 'amount_cents', 'description']
    }
  },
  {
    name: 'pay_x402',
    description: 'Pay via x402 USDC on Base. Use when merchant supports x402 protocol.',
    input_schema: {
      type: 'object',
      properties: {
        merchant_url: { type: 'string' },
        amount_usdc: { type: 'string' },
        description: { type: 'string' }
      },
      required: ['merchant_url', 'amount_usdc', 'description']
    }
  }
];

async function handleToolCall(name, input) {
  if (name === 'check_budget') {
    return {
      remaining: (budget.maxUsd - budget.spentUsd) / 100,
      spent: budget.spentUsd / 100,
      transactions: txLog.length,
      maxPerTransaction: budget.maxPerTx / 100
    };
  }

  if (name === 'pay_mpp') {
    if (input.amount_cents > budget.maxPerTx)
      return { error: 'Exceeds per-transaction limit. Request human approval.' };
    if (budget.spentUsd + input.amount_cents > budget.maxUsd)
      return { error: 'Exceeds total budget.' };

    const pi = await stripe.paymentIntents.create({
      amount: input.amount_cents,
      currency: 'usd',
      payment_method: process.env.AGENT_PAYMENT_METHOD,
      confirm: true,
      metadata: { agent: 'payment-agent-v1', description: input.description }
    });

    budget.spentUsd += input.amount_cents;
    budget.txCount++;
    txLog.push({ protocol: 'mpp', amount: input.amount_cents, id: pi.id, ts: Date.now() });
    return { status: 'paid', receipt: pi.id, amount: input.amount_cents };
  }

  if (name === 'pay_x402') {
    const amountCents = Math.round(parseFloat(input.amount_usdc) * 100);
    if (amountCents > budget.maxPerTx)
      return { error: 'Exceeds per-transaction limit.' };

    // Sign and send x402 payment (simplified)
    const payload = { amount: input.amount_usdc, recipient: 'merchant_address', nonce: Date.now() };
    const sig = await wallet.signMessage({ message: JSON.stringify(payload) });

    budget.spentUsd += amountCents;
    txLog.push({ protocol: 'x402', amount: amountCents, sig, ts: Date.now() });
    return { status: 'paid', protocol: 'x402', amount: input.amount_usdc };
  }
}

// Run the agent
const response = await anthropic.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 4096,
  system: `You are a purchasing agent with a $${budget.maxUsd/100} budget.
    Use pay_mpp for Stripe-enabled merchants, pay_x402 for crypto-native APIs.
    Always check_budget before paying. Log every transaction.
    Request human approval for any single purchase over $${budget.maxPerTx/100}.`,
  tools,
  messages: [{ role: 'user', content: 'Purchase 10 headless browser sessions from Browserbase' }]
});
This tutorial uses test mode credentials. Before production deployment, add: (1) human-in-the-loop approval for purchases above your threshold, (2) rate limiting on payment tool calls, (3) merchant allowlists to prevent purchases from unapproved vendors, (4) persistent transaction logging to a database (not in-memory), and (5) alerting when budget utilization exceeds 80%.
Book free 1-hour consult All Guides Home

Stripe Agent Toolkit MCP, ACP, and Tempo Blockchain

The Stripe Agent Toolkit now ships in MCP format (April 2026), exposing payment operations as standardized MCP tools that any MCP-compatible agent can discover and call. Tools include create_payment_intent, confirm_payment, create_customer, create_subscription, issue_refund, and list_invoices. The MCP transport supports both SSE and Streamable HTTP, enabling integration with Claude Code, Claude Desktop, and custom agent frameworks. Configuration requires only a Stripe API key and an optional list of permitted operations for security scoping.

The Agentic Commerce Protocol (ACP) defines a standardized discovery and negotiation layer for agent-to-merchant interactions. An ACP-compliant merchant publishes a machine-readable catalog (pricing, terms, payment methods, shipping options) at a well-known URL. The purchasing agent retrieves this catalog, selects items, negotiates terms programmatically, and completes payment using AP2, Stripe MPP, or x402. ACP separates commerce logic from payment rails, allowing the same agent to shop across merchants using different payment protocols. The protocol includes dispute resolution flows, return handling, and loyalty program integration.

The Tempo blockchain is now live on mainnet for agent-to-agent payment settlement. Tempo provides sub-second finality for USDC/USDT transfers with transaction fees under $0.001, making it practical for high-frequency micropayment settlement between cooperating agents. Unlike x402 which is HTTP-native and peer-to-peer, Tempo adds a settlement layer for multi-party agent transactions where an escrow or arbitration step is needed. Tempo smart contracts support conditional payments (release funds when task verification passes), time-locked escrow, and multi-signature authorization for enterprise agent deployments.

Related Technologies