How agents pay
MeshGateway merchants speak the Machine Payments Protocol (MPP) - the open standard for machine-to-machine payments over HTTP 402.
The flow
- An agent requests a paid endpoint, e.g.
GET /m/acme/v1/quote. - The gateway answers
402 Payment Requiredwith a signed challenge in theWWW-Authenticateheader (and an x402-compatiblepayment-requiredheader). - The agent signs an EIP-3009 USDC authorization for the exact amount, made out to the merchant's wallet, and retries with an
Authorizationheader. - The gateway verifies and settles on-chain, then fulfills the request with a
Payment-Receiptheader attached.
Discovery
Every merchant publishes offers at /m/{slug}/openapi.json: an OpenAPI 3.1 document where each paid route carries x-payment-info.offers[] entries: amount, currency contract, network, and recipient. Agents can price a call before making it.
Client in five lines
import { Mppx, evm } from 'mppx/client'
import { privateKeyToAccount } from 'viem/accounts'
const account = privateKeyToAccount(process.env.KEY)
const mppx = Mppx.create({ methods: [evm({ account })] })
const res = await mppx.fetch('https://…/m/acme/v1/quote')Works with any x402-compatible client too. The wallet only needs the stablecoin on the merchant's network: USDC on Base, USDG on Robinhood Chain. No ETH required; on Robinhood Chain the one-time Permit2 approval is gas-sponsored by MeshGateway and settlement gas is paid by our relayer.
Non-custodial by design
Payments are USDC transfer authorizations made out directly to the merchant's wallet. MeshGateway verifies and forwards them but can never redirect or hold funds.