- An intent describes the commercial interaction, such as a one-time
chargeor a meteredsession. - 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.
HTTP exchange
MPP uses standard HTTP authentication fields instead of protocol-specific payment headers:| Message | HTTP representation |
|---|---|
| Payment challenge | 402 Payment Required with WWW-Authenticate: Payment ... |
| Payment credential | Retried request with Authorization: Payment ... |
| Successful receipt | Resource response with Payment-Receipt: ... |
| Invalid payment details | Problem Details body using application/problem+json |
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 Solanacharge 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.
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:
server.ts
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:
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 MPPsession 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 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.