← docsView as MarkdownOpen in Claude

Paying for a call

No account, no API key, no invoice. The endpoint quotes a price and your wallet pays exactly that.

The flow

  1. Send the request normally. The answer is 402 with a PAYMENT-REQUIRED header (base64 JSON: amount, asset, payee, network).
  2. Sign a USDC transfer authorisation for exactly that amount (EIP-3009 transferWithAuthorization).
  3. Repeat the same request with the X-PAYMENT header. The facilitator settles and the answer comes back.
curl -i "https://minia2a.uk/x402/math?expr=2%2B2"          # 402 + PAYMENT-REQUIRED
curl -i "https://minia2a.uk/x402/math?expr=2%2B2" -H "X-PAYMENT: <base64 payload>"

The @x402/fetch client does steps 2–3 for you; quickstart shows the one-liner.

Path B: pay from a wallet you control, then present the tx

Send the USDC transfer yourself and present X-Payment-Tx plus X-Payer-Signature (a signature over minia2a payment: <txHash> from the paying wallet). Useful when a treasury wallet pays on behalf of the caller.

When money comes back

Refunds are not netted out of the public delivery numbers. A refund means a buyer did not get what they paid for — treat a rising refund count as a defect signal, not as a cost of business.