Skip to main content

Custom Tokens

By default, x402 Cloud endpoints accept USDC on Base. You can configure any ERC-20 token instead.

How It Works​

x402 supports two token transfer mechanisms:

  • EIP-3009 (USDC, EURC) — gasless transferWithAuthorization. The payer signs an off-chain message and the facilitator submits it. No approval transaction needed.
  • Permit2 (all other ERC-20s) — uses Uniswap's Permit2 contract for a one-time approval, then gasless signed transfers for every subsequent payment.

Bankr auto-detects which mechanism to use based on the token address.

Configuration​

Via bankr.x402.json​

Set tokenAddress per-service or at the top level:

{
"network": "base",
"services": {
"premium-data": {
"description": "Premium market data feed",
"price": "0.10",
"tokenAddress": "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed"
},
"basic-data": {
"description": "Basic market data",
"price": "0.001"
}
}
}

basic-data defaults to USDC. premium-data accepts DEGEN tokens.

Via Dashboard​

  1. Go to bankr.bot/x402
  2. Click on your endpoint
  3. Click Edit endpoint
  4. Under Payment Token, pick USDC or BNKR, or search for any Base token by name, symbol or contract address
  5. Click Save

Via CLI​

The bankr x402 configure wizard doesn't ask for a payment token. To use a custom token from the CLI, set tokenAddress on the service in bankr.x402.json directly, then deploy:

bankr x402 deploy my-service

The symbol and decimals are resolved on-chain from the address at deploy time — you don't set them yourself.

TokenContract AddressTransfer Method
USDC (default)0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913EIP-3009 (gasless)
EURC0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42EIP-3009 (gasless)
DAI0x50c5725949A6F0c72E6C4a641F24049A917DB0CbPermit2
WETH0x4200000000000000000000000000000000000006Permit2

Pricing Considerations​

The price field in your config is always denominated in the token you've selected, not USD. For example:

{
"price": "100",
"tokenAddress": "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed"
}

This charges 100 DEGEN per request, not $100 USD.

Each request is logged in token units along with its USD value at settlement, taken from a spot price (0 if the token has no price). Revenue totals in the dashboard and bankr x402 revenue add up those USD values. The fee-free first 1,000 requests a month apply to USDC- and EURC-priced endpoints only — a custom-token endpoint pays the 5% platform fee from its first request.

Client Compatibility​

Custom-token payments settle through Permit2, and the 402 names the spender the payer must sign for in extra.permit2Spender. Bankr's own clients (bankr x402 call, the agent, and apps' bankr.x402.fetch) read it automatically. A stock x402 client signs a different spender and is rejected with permit2_spender_mismatch, so a custom client needs to sign for extra.permit2Spender.

Permit2 Approval

For non-USDC/EURC tokens, the payer's first payment requires a one-time on-chain approval of the Permit2 contract. Subsequent payments are gasless. Some facilitators sponsor this gas cost automatically.

Smart-contract and delegated wallets work as payers: the Bankr facilitator verifies Permit2 signatures on-chain, so an ERC-1271 signature (a deployed smart account, or a gas-sponsored EIP-7702 wallet such as Bankr's) is accepted alongside a plain EOA signature. Counterfactual (ERC-6492) signatures from an undeployed account are rejected with invalid_permit2_signature — Permit2 itself only validates ECDSA and deployed ERC-1271, so such a payment would verify and then fail to settle. Deploy the account first.