MPP payments
The Machine Payments Protocol (MPP) enables crypto-native, per-request payments on the Tempo blockchain. MPP is an additive payment method alongside Stripe — you choose which to use on each request.How it works
MPP uses an HTTP 402 challenge/response flow:- You send a request to the gateway.
- The server returns
402 Payment Requiredwith a challenge containing the price, token, and recipient. - You sign a Tempo transaction matching the challenge.
- You retry the request with the signed transaction as a credential in the
Authorizationheader. - The server verifies the payment on-chain and returns the response with a
Payment-Receiptheader.
Supported networks
Set
TEMPO_TESTNET=true in your environment to use the testnet during development.Plugin pricing
Each plugin has a fixed per-request price in USD, settled in pathUSD on Tempo.Payment credential
After receiving a 402 challenge, build and sign a credential to send with your retry:Authorization header format
Credential structure
402 challenge structure
When a payment is required, the server responds with:Challenge fields
Verification
The server verifies your credential by checking:- The transaction is hex-encoded and starts with the
0x76type marker. - The recipient address matches the expected recipient.
- The token address matches the expected currency (pathUSD).
- The amount matches the plugin price (within a 0.0001 tolerance).
- The nonce matches the original challenge nonce.
Receipt
On success, the server returns:- A
Payment-Receiptresponse header containing the transaction hash. - The
payment.receiptfield in the JSON response body.
Client usage
UsemppFetch to handle the full 402 flow automatically:
mppFetch options
mppFetch result
Check MPP support
You can check whether an endpoint supports MPP payments:OPTIONS request and checks for a WWW-Authenticate: Payment header.
Troubleshooting
402 response with no MPP challenge
402 response with no MPP challenge
The plugin may not have a configured price. Only plugins listed in the pricing table above support MPP payments.
Credential verification failed
Credential verification failed
- Ensure the
challengeNoncematches the nonce from the 402 response. - Verify the transaction amount matches the challenge amount exactly.
- Check that you are using the correct network (mainnet vs. testnet).
Transaction type error
Transaction type error
The transaction hex must begin with
0x76 (the Tempo transaction type marker). Ensure your signing implementation includes this prefix.