MeshGateway / Docs
Getting Started

Quickstart

Pay a MeshGateway merchant from an agent in five lines.

Pay an endpoint

Any MPP or x402-compatible client works. With mppx:

client.ts
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://api.meshgateway.co/m/acme/v1/quote')

The client catches the 402 challenge, signs the stablecoin authorization, and retries: the response arrives with a Payment-Receipt header attached.

What the wallet needs

The wallet only needs the stablecoin on the merchant's network:

  • USDC on Base
  • USDG on Robinhood Chain

No ETH is required. On Robinhood Chain the one-time Permit2 approval is gas-sponsored by MeshGateway and settlement gas is paid by our relayer: see Robinhood Chain rail.

Price a call before making it

Every merchant publishes machine-readable offers at /m/{slug}/openapi.json: see Discovery.

Verify the payment loop locally

If you're running the gateway yourself (see Self-hosting):

npx mppx validate http://localhost:3000/m/demo        # protocol conformance
npx tsx scripts/test-client.ts                        # full paid request (Base Sepolia)
BUYER_PRIVATE_KEY=0x… npx tsx scripts/approve-permit2.ts    # one-time Permit2 approval on 4663
BUYER_PRIVATE_KEY=0x… npx tsx scripts/test-client-hood.ts   # x402 permit2 payment on Robinhood Chain

The test client needs TEST_BUYER_PRIVATE_KEY holding Base Sepolia USDC (Circle faucet). It asserts the 402 challenge, the discovery doc, and a settled payment with a Payment-Receipt header.

On this page