/stripe-mpp:mpp-server-middlewarefrom stripe-mpp
Implements MPP server-side middleware for Hono, Express, Next.js, and Elysia to protect API routes with HTTP 402 payment gates. Use for configuring payment methods and setting up Mppx server instance.
Ships in stripe-mpp. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Fetch live docs:
https://www.npmjs.com/package/mppx for the current server middleware API and configuration optionsmppx server middleware hono express next.js elysia for framework-specific integration patternssite:github.com stripe-samples machine-payments server for official server sample codehttps://docs.stripe.com/payments/machine/mpp for Stripe-side server configurationThe mppx server middleware intercepts requests to protected routes and implements the full HTTP 402 challenge-response flow:
Authorization: Payment header, returns 402 with WWW-Authenticate: Payment challengePayment-Receipt header to the responseThe central factory creates the server instance:
const mppx = Mppx.create({
secretKey: process.env.MPP_SECRET_KEY, // 32-byte hex for HMAC challenge binding
methods: [/* payment method configurations */],
});
The secretKey is critical — it binds challenges to prevent forgery and replay attacks.
| Framework | Middleware Pattern | Notes |
|---|---|---|
| Hono | app.get('/path', mppx.charge(...), handler) | Native middleware chaining |
| Express | app.get('/path', mppx.charge(...), handler) | Standard Express middleware |
| Next.js | Route handler wrapping | App Router and Pages Router |
| Elysia | Plugin-style integration | Bun-native framework |
Two middleware functions match the two payment intents:
mppx.charge({ amount }) — Per-request payment gate (charge intent)mppx.session({ maxAmount }) — Session-based streaming payment gate (session intent)'100' = $0.01 (USDC has 6 decimals, so 100 = 0.000100, but convention varies by method)A single server can accept multiple payment methods simultaneously:
const mppx = Mppx.create({
secretKey: process.env.MPP_SECRET_KEY,
methods: [
tempo.charge({ /* Tempo config */ }),
stripe.charge({ /* Stripe config */ }),
],
});
The client selects which method to use when fulfilling the challenge.
For routes where the price depends on the request:
mppx.charge()The middleware returns RFC 9457 Problem Details on payment errors:
| Status | Type | When |
|---|---|---|
| 402 | payment-required | No credential provided |
| 402 | verification-failed | Invalid proof of payment |
| 402 | payment-expired | Challenge or credential expired |
| 402 | malformed-credential | Unparseable credential |
secretKey, never hardcodeFetch the latest mppx package README for exact middleware API signatures, configuration options, and framework-specific examples before implementing.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin stripe-mpp12 skills in this plugin
/mpp-charge-flowImplement MPP one-time charge payment flows — per-request payment gates for API monetization, data access, and file downloads. Use when building pay-per-call APIs or protecting individual resources with HTTP 402 charges./mpp-client-fetchImplement MPP client-side payment handling with mppx.fetch(). Use when building AI agents or automated clients that consume 402-protected APIs, handling the transparent challenge-response payment flow./mpp-conformanceValidate MPP implementations against the specification — verify HTTP 402 challenge-response compliance, header formats, payment method correctness, service discovery, and production readiness. Use when auditing an MPP integration or preparing for production launch.Other plugins' skills for the same job