{
  "id": "mpp.middleware",
  "protocol": "mpp",
  "layer": "payment",
  "role": "merchant",
  "status": "optional",
  "title": "Add mppx server middleware",
  "description": "MPP uses Challenge, Credential and Receipt over HTTP 402 with WWW-Authenticate: Payment and Authorization: Payment headers.",
  "goal": "Accept agent payments by card (via Stripe), stablecoins or custom methods on one interface.",
  "note": "Intents: charge, session and subscription. MPP is backwards compatible with x402 clients per Cloudflare.",
  "how_to_implement": {
    "steps": [
      "npm i hono mppx",
      "Store the signing key: npx wrangler secret put MPP_SECRET_KEY",
      "Add mppx.charge(...) before the paid handler."
    ],
    "snippet": {
      "lang": "js",
      "code": "const mppx = Mppx.create({\n  methods: [tempo.charge({ testnet: true })],\n  secretKey: workerEnv.MPP_SECRET_KEY,\n});\napp.get(\"/premium\", mppx.charge({\n  amount: \"0.01\",\n  currency: \"0x20c0000000000000000000000000000000000000\",\n  description: \"Premium API access\",\n  recipient: \"<YOUR_WALLET_ADDRESS>\",\n}), (c) => c.json({ access: \"paid\" }));",
      "source_url": "https://developers.cloudflare.com/agents/tools/payments/mpp/accept-payments/",
      "source_label": "Cloudflare: accept payments with MPP"
    }
  },
  "resources": [
    {
      "label": "MPP server quickstart",
      "url": "https://mpp.dev/quickstart/server",
      "type": "docs",
      "publisher": "MPP"
    },
    {
      "label": "MPP specs on GitHub",
      "url": "https://github.com/tempoxyz/mpp-specs",
      "type": "spec",
      "publisher": "Tempo (MPP)"
    },
    {
      "label": "Cloudflare: accept payments with MPP",
      "url": "https://developers.cloudflare.com/agents/tools/payments/mpp/accept-payments/",
      "type": "docs",
      "publisher": "Cloudflare"
    }
  ],
  "audit": {
    "method": "http_get",
    "automatable": true,
    "url_pattern": "{paid_route}",
    "expect": {
      "status": 402,
      "headers_present": [
        "www-authenticate"
      ],
      "header_contains": {
        "www-authenticate": "Payment"
      }
    },
    "human": "Unpaid request returns 402 with WWW-Authenticate: Payment; a paid retry returns a Payment-Receipt header."
  },
  "how_to_verify": "Unpaid request returns 402 with WWW-Authenticate: Payment; a paid retry returns a Payment-Receipt header.",
  "artifacts": [
    "mppx",
    "WWW-Authenticate: Payment",
    "Payment-Receipt"
  ],
  "depends_on": [],
  "status_note": "Intents: charge, session and subscription. MPP is backwards compatible with x402 clients per Cloudflare.",
  "verified": true,
  "slug": "mpp-middleware",
  "category": "payment",
  "url": "https://vreeman.ai/commerce/checklist#mpp.middleware",
  "updated": "2026-10-12",
  "sources": [
    {
      "label": "MPP server quickstart",
      "url": "https://mpp.dev/quickstart/server",
      "type": "docs",
      "publisher": "MPP"
    },
    {
      "label": "MPP specs on GitHub",
      "url": "https://github.com/tempoxyz/mpp-specs",
      "type": "spec",
      "publisher": "Tempo (MPP)"
    },
    {
      "label": "Cloudflare: accept payments with MPP",
      "url": "https://developers.cloudflare.com/agents/tools/payments/mpp/accept-payments/",
      "type": "docs",
      "publisher": "Cloudflare"
    }
  ],
  "related_slugs": []
}