Sign with a key from the environment
SpendLimitExceededError before your signing function runs. You can also restrict assets, networks and recipients: spend controls.
A runnable LocalNet example
Quickstart step 5 runslocalnet/js_pay.mjs: it funds an account from LocalNet’s KMD, pays a 402 from localnet/server_for_js.py (5,000 microALGO on port 9221), checks the exact balance drop, and shows an over-cap demand being refused.
200 with a PAYMENT-RESPONSE header that carries the settlement result, including the transaction id.
Calling MCP tools from Node
x402-avm-js builds and signs payments; it has no MCP client transport. To call paid MCP tools, use paid_mcp_session from Python, or read the tool call’s 402 and pay it yourself.