How x402 works
The agent calls a paid endpoint. The endpoint answers402 Payment Required with a challenge: the price, the asset, the network and the address to pay. The client pays that amount in USDC and retries, and the call goes through. No account, no API key, no invoice.
Make the call
UsePOST /api/v1/pay (or the pay MCP tool) with type: "x402". Open Solid makes the request, reads the challenge, pays it from the wallet and returns the API’s own response.
The response is
{replayed, status, ok, paid_usd, result, activity}. result is what the API returned: JSON when it sent JSON, otherwise text.
Ceilings
The quote in the 402 challenge is checked before anything is signed:- Over
max_usd: refused with402. Nothing is charged; retry with a higher cap if the price is right. - Over the spend limit: refused with
403andterminal: true. Ask the owner to raise the limit; never split a call to get under it.
max_usd can only tighten: it lowers the ceiling for one call and can never raise the owner’s limit.
Networks
Open Solid pays x402 challenges in USDC on Base. The wallet’s Solana and Base balances act as one: if the Base side is short, the difference moves over from Solana automatically before paying. An API that only accepts other networks is refused with422 and nothing is charged.
Refusal or endpoint error
- Refusal: the price, the network or a limit didn’t fit, so nothing was signed. It’s safe to retry with corrected input.
- Endpoint error: the service answered non-2xx after a payment was offered. Payment may or may not have settled. Don’t blindly repeat a paid request. Check
GET /api/v1/activityfirst, and reuse the sameIdempotency-Keywhen you do retry.