Skip to main content
Use this guide to integrate Meridian x402 payments on EVM chains where the payment token exposes native EIP-3009 transferWithAuthorization. It is written for sellers, buyers, and AI coding agents implementing either side of the payment flow. This path applies to chains such as Base, Ink, HyperEVM, Optimism, Polygon, and Unichain when the selected payment token natively supports EIP-3009. Do not use Permit2 on these chains for the normal USDC x402 flow. Permit2 is only for chains whose payment token does not expose EIP-3009, such as MegaETH, BSC, and BOT Chain. For USDC routes supported by Across, this same EIP-3009 path can settle cross-chain. The seller exposes one paymentRequirements entry per source chain the buyer can pay from, and uses extra.destinationChainId when the recipient should be paid on a different chain.

How the flow works

Meridian-specific rules:
  • paymentRequirements.payTo is the Meridian facilitator, not the seller wallet
  • paymentRequirements.asset is the token that implements EIP-3009
  • paymentRequirements.network is the source chain the buyer pays from
  • authorization.to is the Meridian facilitator
  • The EIP-712 verifying contract is paymentRequirements.asset
  • The EIP-712 primary type is TransferWithAuthorization
  • paymentRequirements.extra.destinationChainId enables an Across-backed destination chain when it differs from the source chain
  • paymentRequirements.extra.creditedRecipient can carry the seller’s final recipient address when it differs from the facilitator-bound payTo
  • The buyer does not approve Permit2, the facilitator, or any proxy
  • The buyer does not sign a Permit2 witness payload
  • The seller keeps the Meridian API key on the backend

Prerequisites

Seller:
  • A Meridian organization
  • An organization API key from https://mrdn.finance/dev/api-keys
  • A backend endpoint that can receive paymentPayload from the buyer
Buyer:
  • A wallet on the selected chain
  • Balance of the selected EIP-3009 payment token
Install the common client dependency:
Do not install @uniswap/permit2-sdk for this flow.

Network constants

The token addresses below are Meridian’s default EIP-3009 payment tokens for common networks. If your application accepts another token on the same chain, only use this flow after confirming that token implements EIP-3009 transferWithAuthorization. Otherwise use the non-EIP-3009 Permit2 guide.

Seller setup

1. Create a Meridian API key

Seller-side setup starts in Meridian:
  1. Connect the seller wallet at https://mrdn.finance
  2. Open https://mrdn.finance/dev/api-keys
  3. Create an organization-scoped API key
  4. Store the public pk_... key on the server
Use the key in the Authorization header when calling Meridian:
The API key can also be created programmatically with a valid SIWE session cookie:

2. Choose the network and amount

Amounts must use the selected source token’s base units. USDC-style EIP-3009 tokens usually have 6 decimals, but still bind the amount to the configured source token.

3. Build paymentRequirements

Use the EIP-3009 token address as asset. Keep payTo pointed at the Meridian facilitator.
If you expose a standard HTTP 402 challenge, return:

4. Expose multiple source-chain routes

If the seller wants to accept payments from several chains, return one paymentRequirements object per accepted source chain in accepts. The buyer or SDK selects the entry matching the buyer’s connected wallet chain. For a seller that wants to receive on Base but accept payment from Base, Ink, and Optimism:
In this model, an Ink-funded buyer pays the network: "ink" requirement. The buyer signs on Ink against Ink USDC, Meridian pulls funds into the Ink facilitator, and Across routes the output to Base before final settlement to creditedRecipient. Do not return only a Base requirement if you expect buyers to pay from Ink, Optimism, or another chain. A paymentRequirements object is source-chain specific because the EIP-712 signature domain includes the source chain and source token contract. Across currently uses exact-input routing in this flow. If the seller must receive an exact destination-chain amount, quote the route and set each source-chain maxAmountRequired high enough to cover Across fees.

5. Receive paymentPayload

The buyer sends raw JSON, not a transaction they submit on-chain. Build or retrieve the matching paymentRequirements server-side; do not trust buyer-supplied requirements for pricing, recipient, network, or token selection.

6. Settle with Meridian

Call POST /v1/settle from the seller backend. Do not expose the Meridian API key to an untrusted client.

Buyer setup

1. Select a payment requirement

Use the seller-provided requirement for the network and token the buyer will pay with. If the seller returned several accepts entries, choose the route whose network matches the buyer’s connected source chain.
For cross-chain routes, do not change the signing domain to the destination chain. The buyer always signs on the source chain selected by paymentRequirements.network.

2. Sign TransferWithAuthorization

The buyer signs typed data against the token contract. There is no ERC-20 approval, no Permit2 allowance, and no witness object.

3. Send paymentPayload to the seller

Serialize bigint values as decimal strings. Keep the nonce as the original 32-byte hex string.

Checklist for AI agents

  • Read the seller’s existing route structure before adding payment handling
  • Keep settlement on the backend
  • Use this guide for Base, Ink, HyperEVM, and other EIP-3009 token chains
  • Use asset = EIP-3009 token address
  • Use payTo = Meridian facilitator
  • For multi-chain sellers, return one accepts entry per source chain
  • For Across routes, keep network, asset, and payTo source-chain based
  • For Across routes, set extra.destinationChainId to the settlement chain id
  • Put the final seller recipient in organization settings or extra.creditedRecipient
  • Use authorization.to = Meridian facilitator
  • Use domain.verifyingContract = paymentRequirements.asset
  • Use primaryType = TransferWithAuthorization
  • Generate a fresh 32-byte nonce per payment
  • Convert every bigint in paymentPayload to a string before JSON encoding
  • Do not add Permit2 approval, Permit2 SDK code, or Permit2 witness fields

Common mistakes

  • Using Permit2 on Base, Ink, HyperEVM, or another native EIP-3009 token chain
  • Setting payTo to the seller wallet
  • Setting authorization.to to the seller wallet
  • Returning only a Base requirement when buyers need to pay from Ink or another source chain
  • Signing with the destination chain id for a cross-chain payment
  • Signing with the facilitator as the EIP-712 verifying contract
  • Using the wrong token name or version in the EIP-712 domain
  • Reusing an EIP-3009 nonce
  • Sending raw bigint values through JSON
  • Putting the Meridian API key in browser code

References