Quick diagnosis
All facilitator codes are explained on Error codes.
LocalNet not reachable
-
Start LocalNet:
algokit localnet start. -
Check algod:
-
Check the endpoints and tokens: algod
http://localhost:4001and KMDhttp://localhost:4002use 64 ×a; the indexer athttp://localhost:8980needs no token.
Asset not opted in
An account must opt in to an ASA, such as USDC, before it can receive it, and both the vendor’spay_to account and the buyer need it. The opt-in code is in Accept USDC.
Balance below the minimum
Every account must keep 100,000 microALGO (0.1 ALGO), plus 100,000 microALGO for each asset it has opted in to (applications add more). An account cannot spend below this, so a payment that would cross it fails simulation. Top the account up with ALGO.The client keeps getting 402 after paying
The server rejected the payment and answered with the challenge again. Look at the server’s logs, or decode the response, for the failure reason. Common causes:- The transactions expired (their last valid round passed) between building and sending.
- The group was modified after signing, so the group id or signature no longer matches.
- The buyer cannot cover the amount.
- The client is on a different network from the server.
x402 httpx client does not loop: after a bounded number of paid retries it returns the server’s answer, so a 402 after paying reaches your code.
Prices below the fee floor
allow_loss=True to subsidize calls on purpose. See the fee floor.