x402 quickstart
1. See the price (free)
curl -i -X POST https://x402-v2-mint-weather-forecast.vercel.app/v1/weather-forecast \
-H 'content-type: application/json' -d '{"lat":41.88,"lon":-97.74}'
# HTTP/2 402 + PAYMENT-REQUIRED: amount 3000 (= $0.003 USDC), network eip155:8453
2. Pay and call
Use any x402 v2 client (for example @x402/fetch or x402 for Python) with a Base wallet holding USDC. It reads the 402, signs, and retries with PAYMENT-SIGNATURE.
import { wrapFetchWithPayment } from "@x402/fetch";
const pay = wrapFetchWithPayment(fetch, yourSigner);
const r = await pay("https://x402-v2-mint-weather-forecast.vercel.app/v1/weather-forecast",
{ method: "POST", headers: {"content-type":"application/json"}, body: JSON.stringify({lat:41.88, lon:-97.74}) });
console.log(await r.json());
3. Find more services
Browse the marketplace or read each service's discovery files.