Skip to content
The Machine Payments Protocol (MPP) applies HTTP authentication semantics to payments. A server challenges an unpaid request, a client returns a payment credential, and the server returns a receipt after it accepts the payment. MPP separates three concerns:
  • An intent describes the commercial interaction, such as a one-time charge or a metered session.
  • A payment method describes how value moves. The Solana method supports native SOL and SPL tokens for charges.
  • An HTTP transport carries challenges, credentials, receipts, and errors.
MPP is published as a set of Internet-Drafts. Treat the current specifications as the source of truth and expect details to evolve while the drafts are work in progress.

​HTTP exchange

MPP uses standard HTTP authentication fields instead of protocol-specific payment headers:
MessageHTTP representation
Payment challenge402 Payment Required with WWW-Authenticate: Payment ...
Payment credentialRetried request with Authorization: Payment ...
Successful receiptResource response with Payment-Receipt: ...
Invalid payment detailsProblem Details body using application/problem+json
MPP Charge FlowMPP Charge Flow

MPP Charge Flow

A challenge includes a server-generated ID, realm, method, intent, encoded payment request, and expiry. The credential echoes the challenge and adds the method-specific payment proof. The server must verify both pieces; a valid transfer that belongs to a different challenge must not unlock the resource.

​One-time Solana charges

The Solana charge intent supports two credential types:
  • Pull mode uses a signed transaction. The client signs the transfer and sends the transaction to the server. The server verifies, optionally adds a fee-payer signature, broadcasts, confirms, and returns the transaction signature in its receipt.
  • Push mode uses a transaction signature. The client broadcasts first, then sends the confirmed signature to the server. The server fetches and verifies the transaction before returning the resource.
Pull mode enables server-sponsored transaction fees and server-side retry logic. Push mode is useful when a wallet requires the client to submit its own transaction, but it cannot use server fee sponsorship. For the normative fields and verification rules, see the Solana charge specification.

​Add an MPP charge to an Express API

The Solana Pay Kit provides a current TypeScript integration for MPP and x402. Create a project and install it with Express. "type": "module" lets the server use top-level await:
This smallest example uses the hosted Surfpool sandbox and the package’s public demo recipient. It is for local development only:
server.ts
The payment-aware request below uses the pay command-line client. Install it with brew install pay on macOS, or download the binary from the latest pay release on Linux and Windows. To skip the install, replace pay with npx @solana/pay. Pay.sh covers the installation options. Run the server and compare an unpaid request with a payment-aware request:
The route handler runs only after the middleware accepts the payment.
Known issue: the sandbox payment failsAs of November 2026, the unpaid request returns the 402 challenge as expected, but the paid request ends with Server returned 402 again after payment. The server log shows Transaction simulation failed: Blockhash not found when @solana/pay-kit settles the payment on the hosted sandbox. The page’s code is not the cause. Follow Solana Pay Kit for the fix. To complete an MPP payment locally in the meantime, run the Pay.sh gateway, which issues MPP challenges.
Replace every sandbox default in productionConfigure an explicit network, merchant recipient, dedicated RPC, stable challenge-binding secret, production signer, and durable replay store. Never route real payments to a package demo signer.

​Metered sessions

Use a Solana MPP session when a client will make many small, related payments. A session opens an onchain payment channel with a maximum deposit, then uses cumulative signed vouchers as usage grows. The server can verify vouchers offchain and settle the highest accepted amount later. This is useful for token-metered inference, byte-metered downloads, live data, and repeated tool calls. It is not the same as sending a separate onchain payment for every event.
MPP Session LifecycleMPP Session Lifecycle

MPP Session Lifecycle

Call a session a session payment, payment channel, or capped repeated authorization. Only call it a streamed payment when the service and payment contract actually meter a stream of usage.

​Production verification

For every Solana charge, the server must verify at least:
  • The challenge is authentic, unexpired, bound to this request, and intended for this realm.
  • The transaction uses the expected network, asset or mint, recipient, amount, and token program.
  • Any fee-payer or associated-token-account instructions are explicitly permitted and cannot drain the server signer.
  • The transaction succeeded at the required commitment level.
  • The transaction signature has not already been consumed.
  • The replay check and consume operation are atomic across all server instances.
For sessions, also persist the channel state, accepted cumulative amount, and settlement watermark in a shared store. Document how clients recover unused funds if the server becomes unavailable.