Paying for Resources
Paying for an x402 resource requires no account, no API key, and no signup. You need a wallet with USDC and a client that speaks x402.
The Payment Flow
Step by step
1. Request the endpoint. Any HTTP method works. If the resource is paid, you get back a 402 Payment Required with a JSON body listing what the seller accepts.
2. Pick a chain. The accepts array may list multiple chain/asset pairs. Pick the one your wallet is funded on.
3. Build and sign. Construct a USDC transfer matching the amount and payTo, sign it with your wallet. On Solana, the facilitator's feePayer pays transaction fees for you.
4. Retry with payment. Base64-encode the signed transaction and send it in the X-PAYMENT header:
5. Get your data. The server forwards your payment to the facilitator, which verifies it, submits it on-chain, and returns a settlement proof. You get the API response.
Using the SDK
The @dexterai/x402 SDK handles steps 2-4 automatically:
wrapFetch intercepts 402 responses, parses requirements, signs the payment, and retries — all transparent to your code.
Using OpenDexter MCP Tools
Agents connected to OpenDexter use the five-tool flow:
x402_search— find resources by keyword, category, or chainx402_check— preview pricing before committingx402_wallet— get your session wallet addresses and balancesx402_fetch— make the paid request (payment handled automatically)x402_pay— explicit payment for advanced flows
Funding Your Wallet
You need USDC on whichever chain the resource accepts:
- Solana USDC:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v - EVM USDC: Standard USDC contract on Base, Polygon, Arbitrum, Optimism, Avalanche, or SKALE
On Solana, the facilitator sponsors transaction fees — you only need USDC, not SOL.
Common Failure Modes
| Problem | Cause | Fix |
|---|---|---|
insufficient_balance | Wallet doesn't have enough USDC | Fund your wallet |
payment_expired | Transaction took too long to settle | Retry — the SDK handles this automatically |
wrong_network | Payment was on a chain the seller doesn't accept | Check accepts array for supported chains |
resource_unavailable | Endpoint is down or removed from marketplace | Try a different resource |