agentwallets.si
← Back to Blog

EDITORIAL ARTICLE

x402 Explained: How an Agent Can Pay for an API Request

Project reference · x402 ↗
Article concepts · illustration
01Payment request02Payment payload03Verify and settle

A research agent wants a single data query. The service charges for access, but the agent has no subscription. x402 describes a way for a server and client to exchange payment requirements and payment information as part of accessing a resource.

The following is a conceptual example, not a live transaction. Exact steps and supported payment schemes depend on the implementation.

sequenceDiagram participant C as Client or agent participant S as Data service participant W as Wallet participant F as Payment facilitator C->>S: Request data S-->>C: Return payment requirements C->>W: Prepare payment authorization W-->>C: Return payment payload C->>S: Retry with payment payload S->>F: Verify and process payment F-->>S: Return result S-->>C: Deliver data if conditions are met

What happens in the example?

  1. The client requests a protected resource.
  2. The service responds with payment requirements, such as an accepted scheme and amount.
  3. The client prepares a payment payload using a compatible payment mechanism.
  4. The client sends the request with that payload. The service verifies and processes it according to its implementation, potentially using a facilitator.
  5. The service delivers the resource when its conditions are met.

The x402 HTTP transport specification describes the HTTP interaction; the protocol specification describes the broader roles and structures. Verification, settlement and delivery order must be checked against the specific implementation.

Component Its question
User or policy Is this agent allowed to spend?
Wallet How can an authorized payment be signed or made?
x402 How are payment requirements and payment information exchanged?
Service What is sold and when is it delivered?

What x402 does not decide

It does not automatically set the user’s budget or determine whether a purchase is worthwhile. It also does not by itself guarantee a refund, service quality, or safe handling of every timeout. Check the service’s terms, total cost, supported network, and retry behavior before relying on a real integration.

For the broader journey, read What Is Agentic Payment? and What Is an Agent Wallet?. Sources reviewed 2026-10-30; no live payment was performed.