{
  "id": "x402.cloudflare.proxy",
  "protocol": "x402",
  "layer": "payment",
  "role": "merchant",
  "status": "optional",
  "title": "Put an x402 paywall in front of any origin with a Cloudflare Worker",
  "description": "Cloudflare's x402-proxy template returns 402 on protected routes and forwards paid requests to your origin.",
  "goal": "Monetise APIs or content for agents without changing origin code.",
  "note": "With Bot Management you can charge only low bot scores and allowlist crawlers by detection ID.",
  "how_to_implement": {
    "steps": [
      "Deploy the x402-proxy template.",
      "Set PAY_TO, NETWORK and PROTECTED_PATTERNS in wrangler.jsonc.",
      "Optionally add bot_score_threshold and except_detection_ids."
    ],
    "snippet": {
      "lang": "json",
      "code": "{\n  \"vars\": {\n    \"PAY_TO\": \"0xYourWalletAddress\",\n    \"NETWORK\": \"base-sepolia\",\n    \"PROTECTED_PATTERNS\": [\n      { \"pattern\": \"/api/premium/*\", \"price\": \"$0.10\", \"description\": \"Premium API access\" }\n    ]\n  }\n}",
      "source_url": "https://developers.cloudflare.com/agents/tools/payments/x402/charge-for-http-content/",
      "source_label": "Cloudflare: charge for HTTP content with x402"
    }
  },
  "resources": [
    {
      "label": "Cloudflare: charge for HTTP content with x402",
      "url": "https://developers.cloudflare.com/agents/tools/payments/x402/charge-for-http-content/",
      "type": "docs",
      "publisher": "Cloudflare"
    },
    {
      "label": "Cloudflare Agents: agentic payments",
      "url": "https://developers.cloudflare.com/agents/tools/payments/",
      "type": "docs",
      "publisher": "Cloudflare"
    }
  ],
  "audit": {
    "method": "http_get",
    "automatable": true,
    "url_pattern": "{paid_route}",
    "expect": {
      "status": 402,
      "headers_present": [
        "payment-required"
      ]
    },
    "human": "Protected pattern returns 402 with PAYMENT-REQUIRED; unprotected routes pass through."
  },
  "how_to_verify": "Protected pattern returns 402 with PAYMENT-REQUIRED; unprotected routes pass through.",
  "artifacts": [
    "x402-proxy Worker",
    "wrangler.jsonc"
  ],
  "depends_on": [
    "x402.middleware"
  ],
  "status_note": "With Bot Management you can charge only low bot scores and allowlist crawlers by detection ID.",
  "verified": true,
  "slug": "x402-cloudflare-proxy",
  "category": "payment",
  "url": "https://vreeman.ai/commerce/checklist#x402.cloudflare.proxy",
  "updated": "2026-10-12",
  "sources": [
    {
      "label": "Cloudflare: charge for HTTP content with x402",
      "url": "https://developers.cloudflare.com/agents/tools/payments/x402/charge-for-http-content/",
      "type": "docs",
      "publisher": "Cloudflare"
    },
    {
      "label": "Cloudflare Agents: agentic payments",
      "url": "https://developers.cloudflare.com/agents/tools/payments/",
      "type": "docs",
      "publisher": "Cloudflare"
    }
  ],
  "related_slugs": [
    "x402-middleware"
  ]
}