viem — your server returns an
x402 challenge, the buyer signs a payment authorization off-chain, and your
server settles it through Meridian’s API. No transaction is submitted by the
buyer and no gas is paid by either side.
Create an API key
Sign in with your wallet at mrdn.finance/dev/api-keys and create a key. Use a See API Keys for details.
pk_test_ key for development and a pk_ key for production. Store it server-side:Set your recipient wallet
In your organization settings, configure the wallet that receives settled
funds. The recipient is tied to your API key — in the payment requirements,
payTo always stays pointed at the Meridian facilitator contract, never at
your own wallet.Pick a network
Take the payment token and facilitator address for your chain from
Supported Networks and keep them in one
config object — everything below reads from it:For development, use a testnet (
pk_test_ key), e.g. Base Sepolia:
chainId: 84532, token 0x036CbD53842c5426634e7929541eC2318f3dCF7e
(tokenName: "USDC"), facilitator
0x8e633dBf31adCc7D41BE3e95B7c8DD3526B5235A. Test USDC is available from
Circle’s faucet.A minimal Base Sepolia test should use:MERIDIAN_API_KEY=pk_test_...- a buyer wallet connected to Base Sepolia (
84532) - Base Sepolia USDC from Circle’s faucet
paymentRequirements.network: "base-sepolia"paymentRequirements.payTo: "0x8e633dBf31adCc7D41BE3e95B7c8DD3526B5235A"
Return a 402 challenge from your server
When an unpaid request hits your paid endpoint, respond with HTTP 402 and
the payment requirements:To accept payments from more than one chain, return one requirement per
source chain in
accepts — see Payment
Types.Sign the payment in the buyer's browser
The buyer signs an EIP-3009 Then send the payload to your server (bigints as decimal strings):
TransferWithAuthorization as typed data —
no approval, no transaction:Settle server-side
Your server settles the payment through Meridian, then serves the paid
response. Never expose the API key to the browser, and do not trust
buyer-supplied pricing, recipient, token, or network values. Rebuild or
look up the matching
paymentRequirements on the server before settlement:Verify in Command Centre
Open Command Centre to see the payment, its
settlement status, and your balance.
Next steps
Manual Integration
The full client-side flow: multi-chain challenges, requirement selection,
and error handling.
Payment Types
EIP-3009, Permit2, and Circle Gateway — and when to use which.
Supported Networks
Chains, tokens, and contract addresses.
AI Skills
Self-contained integration instructions for AI coding agents.