Payment Bots. Guide.

How does an AI agent pay for an API?

An AI agent pays for an API by answering the server's payment request. With x402, the server replies HTTP 402 Payment Required with its payment options, the agent retries the same request with a signed payment, and a facilitator verifies and settles it. x402 docs. The Machine Payments Protocol (MPP) has the same shape with different names: a Challenge, a Credential and a Receipt. mpp.dev overview. L402 does the same with a Lightning invoice. Lightning Engineering, L402. With x402, the agent needs no account with the seller. x402 docs.

Updated .

Last verified . How we verify · Corrections

Which one fits

Which protocol fits how the agent pays
The agent paysProtocolRailWhy
Small pay-per-call payments in a stablecoinx402Crypto. Base or the XRP Ledger, plus Solana.Built for per-request payments. The exact scheme is final once executed. x402 FAQ.
One endpoint that takes stablecoins and cardsMPPBothPayment-method agnostic. mpp.dev FAQ.
Bitcoin over LightningL402Crypto. Lightning.The 402 response carries a token and a Lightning invoice. Lightning Engineering, L402.
A retail checkout with a cardACP or UCPCardsThese are checkout protocols, not per-call payment rails. See the merchant guide below.

What the sources say

  • The x402 flow in the docs: the buyer requests a resource, the server answers 402 with payment instructions, the buyer sends a payment payload, and the server verifies and settles it before returning the resource. x402 docs.
  • A facilitator verifies payments and settles them on the blockchain for the server. The docs say it does not hold funds or act as a custodian. x402 docs, Facilitator.
  • The docs say the public x402.org facilitator is for development. Production use needs a production facilitator, your own, or self-facilitation. x402 docs, Facilitator.
  • Facilitators support Base, Solana, Polygon, Avalanche and other networks, according to the x402 docs. x402 docs, Facilitator. The XRPL AI Hub lists an x402 facilitator for the XRP Ledger. XRPL AI Hub.
  • mpp.dev says a server can answer both x402 and MPP clients from the same endpoint. mpp.dev FAQ.
  • The official x402 FAQ describes the exact scheme as a push payment that is irreversible once executed. x402 FAQ.

Steps

  1. Request the resource without paying. The server answers 402 and lists its accepted payment options, including the scheme, network, asset, amount and receiving address. Source or detail
  2. Check the payment request. Confirm the network, asset and payee against what you allow. A 402 response is only a request, not proof that the payee is who you meant. Source or detail
  3. Pay and retry the same request. With x402, send the signed payment in the PAYMENT-SIGNATURE header. With MPP, send a Credential in reply to the Challenge. Source or detail
  4. Keep the receipt and verify it. A successful response can include a settlement response or receipt. Verify the transaction on the ledger and keep it for review. Source or detail

Common questions

What is HTTP 402?

HTTP 402 Payment Required is a standard but rarely used status code that says payment is required to access a resource. x402 uses it to send the payment details to the client.

Does the agent need an account with the API?

Not with x402. The x402 docs say clients can pay for resources without accounts, sessions or credential management.

Can the payment be reversed?

Usually not. The official x402 FAQ describes the exact scheme as a push payment that is irreversible once executed. A refund, when one exists, is a new payment back to you.

Free and paid

Free and paid. This page, the tracker, the glossary, the safety guide and the RSS feed are free. The Daily Digest at GET /products/digest/latest and the Weekly Roundup at GET /weekly/latest are paid resources for agents. This page does not reproduce their content. Agents start here.

More guides: All guides · Which protocol fits a merchant that takes cards? · Cards or stablecoins for agent payments? · How do I let my agent shop safely? · How do I sell data or content to agents?