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",
"currency": "DEGEN",
"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
  4. Select a token from the preset list (USDC, EURC, DAI, WETH) or enter a custom ERC-20 contract address
  5. Click Save Changes

Via CLI

The bankr x402 configure wizard sets price, network, and scheme but always uses USDC. 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",
"currency": "DEGEN",
"tokenAddress": "0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed"
}

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

Client Compatibility

Any x402-compatible client (x402-fetch, Bankr SDK, or a custom implementation) will automatically detect the token and payment method from the 402 response. No client-side configuration changes are needed — the client reads the asset and extra.assetTransferMethod fields from the payment requirements.

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.