Install any skill in seconds. Free to start, no credit card required.
Get Started Free →TypeScript SDK for the Payment HTTP Authentication Scheme. Handles 402 Payment Required flows with Tempo, Stripe, and other payment methods. Use when integrating payments or mppx into a client or server application.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-09 | ✗→✓ | ▲ Improved | -14% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 2% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -36% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 136% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 96% | 0% |
TypeScript SDK for the "Payment" HTTP Authentication Scheme. Full 402 flow: challenge → credential → receipt.
402 payment handling to a client with Fetch.polyfill or Fetch.from.tempo.charge.tempo.session.stripe.charge.MPP_SECRET_KEY.4217 unless a page explicitly covers Moderato testnet.MPP_SECRET_KEY server-side and out of logs.402 Challenges as authoritative for current payment terms.id and opaque unchanged when responding to a Challenge.USDC.e for Tempo bridged USDC examples, not generic USDC.tsimport { Mppx, tempo } from 'mppx/client' // Polyfills globalThis.fetch to handle 402 automatically Mppx.create({ methods: [tempo({ account })], }) const res = await fetch('https://api.example.com/resource')
Without polyfilling:
tsconst mppx = Mppx.create({ methods: [tempo({ account })], polyfill: false, }) const res = await mppx.fetch('https://api.example.com/resource')
tsimport { Mppx, Store, tempo } from 'mppx/server' import { privateKeyToAccount } from 'viem/accounts' const account = privateKeyToAccount('0x...') const mppx = Mppx.create({ methods: [ tempo.charge({ currency: '0x...', recipient: '0x...' }), tempo.session({ account, chainId: 4217, currency: '0x...', store: Store.memory(), }), ], secretKey: process.env.MPP_SECRET_KEY, }) async function handler(request: Request): Promise<Response> { const result = await mppx.charge({ amount: '1.00' })(request) if (result.status === 402) return result.challenge return result.withReceipt(Response.json({ data: '...' })) }
| Method | Intent | Description | |---|---|---| | tempo.charge | charge | One-time stablecoin payment (TIP-20 token transfer on Tempo) | | tempo.session | session | Streaming payments via payment channels on Tempo | | stripe.charge | charge | One-time payment via Stripe |
tempo() returns [tempo.charge, tempo.session] as a tuple using the current v2 Sessions implementation. Use tempo.charge() or tempo.session() individually if you only need one intent. Use tempo.sessionLegacy only for Legacy Sessions v1 compatibility.
| Path | Purpose | |---|---| | mppx | Core primitives (Challenge, Credential, Method, Receipt, PaymentRequest) | | mppx/client | Mppx, tempo, stripe, session, Transport | | mppx/server | Mppx, tempo, stripe, Transport, Store, NodeListener | | mppx/hono | Hono middleware | | mppx/express | Express middleware | | mppx/nextjs | Next.js middleware | | mppx/elysia | Elysia middleware |
mppx includes a CLI for making paid requests during development:
shnpx mppx account create # create wallet npx mppx mpp.dev/api/ping/paid # make paid request npx mppx example.com -v # verbose output
Other measured skills in the registry, with their headline benchmark lift.