x402 payment API for AI agents
Last reviewed: December 2026
x402 is an open protocol for paying for an HTTP request with stablecoins. The server answers an unpaid request with 402 Payment Required and a price, and the client signs a USDC payment and sends the same request again with the payment attached. Laso Finance runs an x402 API at laso.finance: an AI agent pays USDC on Base or Solana and gets back a prepaid card, a gift card, or a payout to a debit card, a bank account, Venmo or PayPal. The paying wallet is the account, so the agent needs no sign-up form or API key for its first purchase.
What x402 is
HTTP has reserved status code 402 Payment Required since the 1990s without a standard way to use it. x402 defines one. Coinbase started the protocol, and the x402 Foundation under the Linux Foundation now maintains the specification. A paid request takes four steps:
- The client sends an ordinary request, such as
GET /get-card?amount=5. - The server answers
402 Payment Required. The response body and thePAYMENT-REQUIREDheader list the payment options it accepts: the network, the token, the amount in atomic units, and the address to pay. - The client signs a payment for one of those options and repeats the request with a
PAYMENT-SIGNATUREheader. - The server verifies the payment, does the work, settles the payment on-chain and returns the result.
Client libraries such as x402-fetch and x402-axios handle the 402, the signature and the retry, so a paid endpoint is called the same way as a free one. Laso accepts x402 version 2 only.
What Laso’s x402 API does
Every paid route at laso.finance is an x402 endpoint. Each challenge offers USDC on Base (eip155:8453) and on Solana, and the agent pays on whichever network its wallet holds. Fees are included in the quoted amount, so the 402 response states the full price before anything is paid.
| Route | What the agent gets | Price |
|---|---|---|
GET /get-card | A prepaid card for U.S. merchants. The number, expiry and CVV come from the free GET /get-card-data. | $5 to $1,000, no fee |
GET /order-intl-card | A prepaid card for merchants outside the U.S., fulfilled within about 24 hours. | $100 to $1,000 plus 3.8% |
GET /order-gift-card | A gift card from more than 3,000 brands, found with GET /search-gift-cards. | $5 to $9,000, fee up to 4.8% |
GET /get-push-to-card | A transfer to a USD, EUR or GBP debit card. | 10 to 9,541.98 plus 4.8% (min 1.50) |
GET /send-payment | A payout to Venmo or PayPal. The agent’s human verifies their identity once, through a link the API returns. | $5 to $1,000 plus 4.9% (min $1.50) |
GET /send-bank-payment | An ACH payment to a registered U.S. bank account. | $10 to $50,000 plus 0.25% (min $1.50) |
Reading a card, checking a balance, refreshing a token and registering a webhook are free calls, authenticated with the Bearer token that the first paid response returns. An agent without its own wallet can pay through a Laso-managed wallet with the agentX402Pay callable: a human approves the wallet once and sets a per-call spending cap. The same callable also pays x402 endpoints run by other services.
Sample request and response
An unpaid request for a $5 U.S. prepaid card returns the challenge. This is the live response, with the extensions discovery block left out:
curl -i "https://laso.finance/get-card?amount=5"
HTTP/2 402
content-type: application/json; charset=utf-8
payment-required: eyJ4NDAyVmVyc2lvbiI6Mi...
{
"x402Version": 2,
"error": "Payment required",
"resource": {
"url": "https://laso.finance/get-card?amount=5",
"description": "Get a prepaid card for use inside the United States",
"mimeType": "application/json",
"serviceName": "Laso Finance"
},
"accepts": [
{
"scheme": "exact",
"network": "eip155:8453",
"amount": "5000000",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"payTo": "0x3291e96b3bff7ed56e3ca8364273c5b4654b2b37",
"maxTimeoutSeconds": 300,
"extra": { "name": "USD Coin", "version": "2" }
},
{
"scheme": "exact",
"network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
"amount": "5000000",
"asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"payTo": "3MZVk97x9SeRxbYpc3jhzRfU2fyA3emYutnqfn9kNfYX",
"maxTimeoutSeconds": 300,
"extra": { "feePayer": "BENrLoUbndxoNMUS5JXApGMtNykLjFXXixMtpDwDR9SP" }
}
]
}
USDC has six decimals, so an amount of 5000000 is $5.00. The asset on each option is the USDC token on that network. On Solana, Laso pays the network fee (feePayer).
After the client pays and repeats the request, the response carries the order and the credentials for the free routes:
{
"auth": {
"id_token": "eyJ...",
"refresh_token": "AMf...",
"expires_in": "3600"
},
"callable_base_url": "https://laso.finance",
"user_id": "0xabc...",
"card": {
"card_id": "card_abc123",
"usd_amount": 5,
"country": "US",
"timestamp": 1796590384000,
"timestamp_readable": "12/6/2026, 2:53:04 PM",
"status": "pending"
}
}
The card number, expiry and CVV are ready about 7 to 10 seconds later from GET /get-card-data?card_id=card_abc123, called with the id_token as a Bearer token. A payment on Base with wait=true holds the request open until the details are ready and returns them in the same response. The card tutorial covers every step, including what a failed payment returns.
x402 guides
- x402 vs AP2 vs ACP vs MPP vs UCP: the five agent payment protocols, what each one is for, and when to use it.
- x402 vs Stripe Issuing for AI agents: two ways to give an agent a card, compared on setup, cost and spending controls.
- Issue a virtual card with one x402 call: a runnable walkthrough against the live API.
- All agent guides: bank accounts, payouts, gift cards, spending limits and more.
Reference
- openapi.json: the OpenAPI 3.1 contract for every route.
- docs.laso.finance: the API reference and integration guides.
- SKILL.md: setup instructions an agent reads directly.
- /.well-known/x402: the x402 discovery document listing the paid routes.
- Laso for agents: create an account, give your agent a managed wallet, and see what it spends.
Frequently asked questions
Which networks and tokens does Laso’s x402 API accept?
USDC on Base and on Solana. Every 402 challenge lists both options, and the client pays on either one.
Does an agent need an account or an API key to pay?
The wallet that pays becomes the account, so no sign-up step comes first. The first paid response returns an id_token and refresh_token for the free routes. GET /auth returns the same credentials for a wallet signature at no cost, for an agent that needs them before it buys anything.
What happens if an x402 payment fails?
The server answers with a second 402 whose body has success: false and an errorReason such as insufficient_funds. A challenge carries accepts instead, which is how a client tells the two apart. Nothing is charged for a failed settlement, so the agent can retry with a smaller amount or a funded wallet.
Can I test the API without spending money?
An unpaid request to any paid route returns the 402 challenge and costs nothing, which shows the exact price. Payments settle on mainnet with no sandbox, and the smallest card order is $5.
Try it: connect a wallet at laso.finance and you'll have a card, gift card, or payout in minutes.
Building an agent? Point it at laso.finance/SKILL.md — it can set itself up.