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.
How the flow works
paymentRequirements.payTois the Meridian facilitator, not the seller walletpaymentRequirements.assetis the token that implements EIP-3009authorization.tois the Meridian facilitator- The EIP-712 verifying contract is
paymentRequirements.asset - The EIP-712 primary type is
TransferWithAuthorization - 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
paymentPayloadfrom the buyer
- A wallet on the selected chain
- Balance of the selected EIP-3009 payment token
@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-3009transferWithAuthorization. Otherwise use the non-EIP-3009 Permit2 guide.
Seller setup
1. Create a Meridian API key
Seller-side setup starts in Meridian:- Connect the seller wallet at
https://mrdn.finance - Open
https://mrdn.finance/dev/api-keys - Create an organization-scoped API key
- Store the public
pk_...key on the server
Authorization header when calling Meridian:
2. Choose the network and amount
Amounts must use the selected token’s base units. USDC-style EIP-3009 tokens usually have 6 decimals, but still bind the amount to the configured token.3. Build paymentRequirements
Use the EIP-3009 token address as asset. Keep payTo pointed at the Meridian
facilitator.
4. 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.
5. Settle with Meridian
CallPOST /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.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 - 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
paymentPayloadto 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
payToto the seller wallet - Setting
authorization.toto the seller wallet - 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
bigintvalues through JSON - Putting the Meridian API key in browser code