How to turn your API into x402 pay-per-call (USDC on Base)
By Chet Parker · Published 2026-10-14 · Last updated October 14, 2026 · 4 min read
How to turn your API into x402 pay-per-call (USDC on Base)
Listing on PayAPI Market is free. AI agents pay USDC per call. You keep 100%. No API keys or accounts for buyers. Here's how to make your API payable with x402 in four steps.
The x402 flow
x402 is HTTP 402 with crypto settlement. Your API returns a payment requirement, the agent pays on-chain, and your API settles and returns the response. The whole round trip takes about 400 milliseconds.
Step 1: Your API returns HTTP 402 with payment requirements
When an unpaid request arrives, return HTTP 402 with a JSON body containing the price, your payment address, the asset (USDC), the network (Base), and a nonce:
{
"price": "0.002",
"recipient": "0xYourWalletAddress",
"asset": "USDC",
"network": "Base",
"nonce": "unique-request-id"
}
This tells the agent what to pay and where. No signup flow, no API key issuer.
Step 2: The agent pays USDC on Base
The agent signs a USDC transfer for the exact amount you specified and broadcasts it to Base. Settlement is final in about 400ms. The payment is the authorization.
Step 3: The agent retries the request with the payment proof
The agent retries the original request with an X-Payment-Proof header containing the transaction hash:
GET /v1/canonicalize HTTP/1.1
X-Payment-Proof: 0x78c4904db8263fd8ceac4d715a824ff7b9c087d69a9f8e15f7918280c6e3157a
Step 4: Your API verifies, settles, and returns the response
Your API verifies the transaction on Base: the amount matches your price, the recipient is your wallet, and the nonce hasn't been used. Once verified, you return the response.
// Verify the transaction
const tx = await provider.getTransaction(paymentProof);
if (tx.value === expectedPrice && tx.to === yourWallet) {
// Payment valid, return the response
return { result: "your data here" };
}
No refunds, no chargebacks. Settlement is final before your API responds.
A real receipt: CanonicalHash
CanonicalHash (JSON Canonicalization API) charges $0.002 per call. Route: https://canonicalhash-production.up.railway.app/v1/canonicalize. Settled on Base in transaction 0x78c4904db8263fd8ceac4d715a824ff7b9c087d69a9f8e15f7918280c6e3157a, verified 14 Oct 2026.
Settlement-verified means PayAPI paid a real call from our wallet and got a real response back with an on-chain receipt. Not a health ping. A real paid transaction that settled on Base and returned usable data.
Coming soon: Solana support
x402 currently settles on Base (Ethereum L2). Solana settlement support is coming soon, so agents will be able to pay with USDC on Solana for lower transaction costs.
What's on PayAPI Market right now
PayAPI Market has 337 live listings and 325 settlement-verified APIs that accept x402 payments. Every verified listing has been paid at least once by PayAPI's own wallet, so you know the payment flow works before you integrate.
No paid tiers. No enterprise plans. No SLAs. Listing is free and you keep 100% of what the call earns.
Explore and list
- Browse the marketplace: payapi.market/marketplace
- Download verified routes: Export the full verified catalogue as CSV or JSON
- List your API free: payapi.market/list
FAQ
What is x402?
x402 is HTTP status code 402 (Payment Required) with crypto settlement. Your API returns 402 with payment requirements, the agent pays on-chain, and your API verifies and returns the response. Settlement happens in about 400 milliseconds on Base.
Does the buyer need an API key?
No. The payment is the authorization. The agent makes a request, sees the price, pays on-chain, and retries with the payment proof. No signup, no account, no API key.
Which blockchain and token does x402 use?
x402 settles on Base (Ethereum Layer 2) using USDC by default. Solana support is coming soon. Settlement is final in about 400ms and costs a fraction of a cent in gas.
What does listing cost?
Listing is free. There are no subscription tiers, no per-request fees, and no revenue share. You keep 100% of what the call earns. PayAPI Market is a discovery marketplace, not a payment processor.
What does "settlement-verified" mean?
Settlement-verified means PayAPI paid a real call from our own wallet and received a working response with an on-chain receipt. It's not a health check or a ping. It's a real paid transaction that settled on Base and returned usable data. Every verified listing has passed this test at least once.
List your API free at payapi.market/list
Turn your existing API into a pay-per-call service in under an hour. No changes to your core logic. Just add the x402 payment check and start earning from every agent that calls your endpoint.
List your API free at payapi.market/list.