GUIDE · AI AGENT PAYMENTS

How to charge AI agents for your API

Agents need a machine-readable price, an authorization contract, and proof of settlement tied to accepted delivery. HTTP 402 + x402 v2 provides that flow without another account.

1. Return HTTP 402 + PAYMENT-REQUIRED

When unpaid, respond with HTTP 402 and machine-readable PAYMENT-REQUIRED terms containing the network, asset, payTo, resource, and amount. For SML's canonical rail that means Base mainnet USDC.

2. Accept the challenge-bound signature

The caller authorizes the exact challenge and retries with PAYMENT-SIGNATURE. Verify and settle those terms; after accepted delivery, return PAYMENT-RESPONSE with the result. Do not teach callers to reuse stale transaction-hash or legacy X-PAYMENT instructions as the canonical v2 flow.

3. Keep spending under caller control

Your API advertises price and payment requirements. The caller decides whether to authorize the spend. A server should never imply that discovering a paid API grants it permission to spend autonomously.

402 PAYMENT-REQUIRED
→ caller policy checks price + resource
→ PAYMENT-SIGNATURE
→ verify / settle / deliver
→ PAYMENT-RESPONSE
Launchpad Watch it work

4. Price like the market

Commodity machine calls can start at fractions of a cent. See the pricing oracle and expose the exact current price in the 402 challenge rather than relying on copied directory text.

FAQ

Do humans need wallets?

No. Your human experience can stay separate while machine callers use x402 payment terms.

Is this Stripe?

No. The canonical SML machine rail settles USDC on Base. See Stripe vs crypto for APIs.

KEEP GOING · SCRIPTMASTERLABS

Related