From stripe-mpp
Implements MPP client-side payment handling with mppx.fetch() for AI agents and automated clients consuming 402-protected APIs via transparent challenge-response flows.
npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin stripe-mppThis skill is limited to using the following tools:
**Fetch live docs**:
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Acquire memory dumps from live systems/VMs and analyze with Volatility 3 for processes, networks, DLLs, injections in incident response or malware hunts.
Provides x86-64/ARM disassembly patterns, calling conventions, control flow recognition for static analysis of executables and compiled binaries.
Fetch live docs:
https://www.npmjs.com/package/mppx for the current client API and wallet configurationmppx client fetch payment wallet configuration for client-side setup patternssite:github.com stripe-samples machine-payments client for official client sample codehttps://mpp.dev/overview for the client-side protocol flow descriptionmppx.fetch() is a drop-in replacement for the standard fetch() API that transparently handles the full HTTP 402 payment flow:
WWW-Authenticate: Payment challengeAuthorization: Payment credentialPayment-Receipt header from the responseThe developer's code sees only the final successful response — all payment negotiation is handled internally.
import { mppx } from 'mppx/client';
// Configure once
const client = mppx.create({
wallet: {
privateKey: process.env.WALLET_PRIVATE_KEY, // For Tempo/crypto payments
},
// OR for Stripe SPT payments:
stripe: {
sharedPaymentToken: sptToken, // Obtained from SPT provisioning
},
});
// Use like fetch()
const response = await client.fetch('https://api.example.com/paid-resource');
const data = await response.json();
When a server supports multiple payment methods, the client selects based on:
Clients should implement spending controls:
After a successful payment, the Payment-Receipt header contains:
Clients should log receipts for accounting and dispute resolution.
| Scenario | Behavior |
|---|---|
| Insufficient balance | Throw error with details |
| Unsupported payment method | Throw error listing supported methods |
| Challenge expired | Retry with fresh request |
| Network error during payment | Do not retry payment (risk of double-pay) |
| Server returns non-402 error | Pass through as normal fetch error |
The mppx CLI provides a quick way to test payments:
npx mppx https://api.example.com/paid-resource
A client can be configured with multiple payment methods:
const client = mppx.create({
methods: [
{ type: 'tempo', wallet: { privateKey: process.env.WALLET_KEY } },
{ type: 'stripe', spt: { token: sptToken } },
],
preference: ['tempo', 'stripe'], // Try Tempo first, fall back to Stripe
});
Fetch the latest mppx client documentation for exact configuration options, wallet setup, and error types before implementing.