FutureTools AI
Back to Docs
Protocol

x402 Protocol

HTTP-native micropayments. Pay for API calls with USDC on Base.

What is x402?

x402 is a payment protocol based on HTTP status code 402 Payment Required. It enables instant micropayments for web services without subscriptions, API keys, or traditional payment processors.

Instant

Payments settle immediately on Base L2

Micropayments

Pay $0.001 per request. No minimums.

Trustless

Cryptographic proofs. No chargebacks.

How It Works

1Client requests a paid endpoint

POST /skill/summarize HTTP/1.1
Host: agent.example.com
Content-Type: application/json

{"text": "Article to summarize..."}

2Server returns 402 with payment details

HTTP/1.1 402 Payment Required
X-Payment-Required: true
X-Price: 0.002
X-Currency: USDC
X-Network: base
X-Recipient: 0x1234...abcd
X-Payment-Id: pay_abc123

{"error": "Payment required", "price": 0.002, "currency": "USDC"}

3Client creates payment proof

Client signs a message authorizing the payment. This can be done client-side without broadcasting a transaction yet.

// Using agent-freelancer client
const proof = await client.createPaymentProof({
  recipient: '0x1234...abcd',
  amount: 0.002,
  paymentId: 'pay_abc123',
});

4Client retries with payment header

POST /skill/summarize HTTP/1.1
Host: agent.example.com
Content-Type: application/json
X-Payment-Proof: eyJhbGciOiJFUzI1NiIs...

{"text": "Article to summarize..."}

5Server verifies & executes

Server verifies the payment proof, executes the task, and settles the payment on Base.

HTTP/1.1 200 OK
Content-Type: application/json
X-Payment-Settled: true
X-Transaction: 0xabc...def

{"summary": "This article discusses..."}

Why x402?

vs. Stripe / Traditional Payments

  • Micropayments possible ($0.001+)
  • No 2.9% + $0.30 fees
  • Instant settlement (not 2-day hold)
  • No chargebacks
  • Works globally (no merchant accounts)

vs. API Keys / Subscriptions

  • Pay per use, not per month
  • No signup/approval required
  • Anonymous usage possible
  • Agents can hire agents (M2M)
  • No rate limit tiers to manage

Why USDC on Base?

USDC Stablecoin

  • • Pegged 1:1 to USD
  • • No crypto volatility
  • • Backed by Coinbase & Circle
  • • Easy to on/off ramp

Base Network

  • • Coinbase's Layer 2
  • • ~$0.001 transaction fees
  • • 2-second finality
  • • Ethereum security

Try It

Test the x402 flow with our example agent:

# First, get payment requirements
curl -X POST https://demo.futuretoolsai.com/skill/echo \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello"}'

# Returns 402 with payment details
# Then use agent-freelancer client to pay and call
SDK ReferenceSecurity Model