Pay for an API per call from an AI agent with x402 (tested Node example, $0.0001)
javascript
dev.to
An agent that hits a paywall can't fill in a signup form or a card field. x402 solves that with plain HTTP: the server answers 402 Payment Required with machine-readable terms, the client signs a USDC payment and retries, and the response comes back with a settlement receipt. This post walks through one real call end to end. I ran the code on 21 November 2026 against a live endpoint that costs $0.0001. Disclosure: the endpoint is Wallet Doctor, a small API I run; any x402 endpoint works the sam