{
  "id": "x402.middleware",
  "protocol": "x402",
  "layer": "payment",
  "role": "merchant",
  "status": "optional",
  "title": "Add x402 payment middleware to paid routes",
  "description": "Unpaid requests get HTTP 402 with a PAYMENT-REQUIRED header; the client pays and retries with PAYMENT-SIGNATURE; the server returns PAYMENT-RESPONSE.",
  "goal": "Charge agents per request without accounts or API keys.",
  "note": "Stablecoin settlement (for example USDC on Base). A facilitator can verify and settle so you need no chain connectivity.",
  "how_to_implement": {
    "steps": [
      "Install the x402 middleware for your framework (Express, Hono, Next).",
      "Configure price, network, pay-to address and facilitator per route.",
      "Test on base-sepolia before base."
    ]
  },
  "resources": [
    {
      "label": "x402 quickstart for sellers",
      "url": "https://docs.x402.org/getting-started/quickstart-for-sellers",
      "type": "docs",
      "publisher": "x402"
    },
    {
      "label": "x402 on GitHub",
      "url": "https://github.com/x402-foundation/x402",
      "type": "spec",
      "publisher": "x402 Foundation"
    },
    {
      "label": "Cloudflare Agents: x402",
      "url": "https://developers.cloudflare.com/agents/tools/payments/x402/",
      "type": "docs",
      "publisher": "Cloudflare"
    }
  ],
  "audit": {
    "method": "http_get",
    "automatable": true,
    "url_pattern": "{paid_route}",
    "expect": {
      "status": 402,
      "headers_present": [
        "payment-required"
      ]
    },
    "human": "Request a paid route without payment: 402 with a PAYMENT-REQUIRED header."
  },
  "how_to_verify": "Request a paid route without payment: 402 with a PAYMENT-REQUIRED header.",
  "artifacts": [
    "HTTP 402 response",
    "PAYMENT-REQUIRED",
    "PAYMENT-SIGNATURE",
    "PAYMENT-RESPONSE"
  ],
  "depends_on": [],
  "status_note": "Stablecoin settlement (for example USDC on Base). A facilitator can verify and settle so you need no chain connectivity.",
  "verified": true,
  "slug": "x402-middleware",
  "category": "payment",
  "url": "https://vreeman.ai/commerce/checklist#x402.middleware",
  "updated": "2026-10-19",
  "sources": [
    {
      "label": "x402 quickstart for sellers",
      "url": "https://docs.x402.org/getting-started/quickstart-for-sellers",
      "type": "docs",
      "publisher": "x402"
    },
    {
      "label": "x402 on GitHub",
      "url": "https://github.com/x402-foundation/x402",
      "type": "spec",
      "publisher": "x402 Foundation"
    },
    {
      "label": "Cloudflare Agents: x402",
      "url": "https://developers.cloudflare.com/agents/tools/payments/x402/",
      "type": "docs",
      "publisher": "Cloudflare"
    }
  ],
  "related_slugs": []
}