Network settings
The token’s details, as returned by
/supported:
1. Check the token is supported
eip155:11142220 entry with x402Version: 2, and confirm the USDC address appears in its supportedAssets.
2. Run a paid endpoint
Follow the Quickstart to run the example server. Use these values in its.env:
AMOUNT is in the token’s smallest unit. USDC has 6 decimals, so 10000 is 0.01 USDC. The price must also be higher than the x402Go fee.
Start the server and check that an unpaid request is refused:
402 Payment Required with the payment request in the response.
3. Create and fund a test wallet
Make a new wallet just for testing. Never use a wallet that holds real funds.4. Run the client
In a separate folder:.env with the key from the previous step:
client.ts:
200, the paid response, and a settlement receipt that includes the transaction hash.
The
spendControls block is required. By default the x402 client only pays tokens it already recognizes, with a $1 cap per payment, and it refuses anything else with a “rejected by spendControls” error. The asset value must match your server’s ASSET. The cap is a safety limit for your wallet, so set it as low as you like.5. Verify settlement
After a paid request:- Check the transaction hash on Celo Sepolia Celoscan.
- Check your payout wallet. It should have received the payment minus x402Go’s fee.
Troubleshooting
Before mainnet
Move to mainnet only after a test payment succeeds end to end:- Check
GET /supportedfor the mainnet network (eip155:42220) and the token you want. - Update the server’s
NETWORK,ASSET,ASSET_NAME,ASSET_VERSION,AMOUNT, andMETHOD. - Update the client’s network and token in
allowedAssets, with a cap you’re comfortable with. - Confirm your payout wallet in the dashboard, then make one small real payment.