This page explains the roles and responsibilities of the client and server in the x402 protocol.
Understanding these roles is essential to designing, building, or integrating services that use x402 for programmatic payments.
Client refers to the technical component making an HTTP request. In practice, this is often the buyer of the resource.
Server refers to the technical component responding to the request. In practice, this is typically the seller of the resource
The client is the entity that initiates a request to access a paid resource.
Clients can include:
402 Payment Required
response and extract payment details.X-PAYMENT
header containing the signed payment payload.Clients do not need to manage accounts, credentials, or session tokens beyond their crypto wallet. All interactions are stateless and occur over standard HTTP requests.
The server is the resource provider enforcing payment for access to its services.
Servers can include:
402 Payment Required
, including all necessary payment details in the response body.Servers do not need to manage client identities or maintain session state. Verification and settlement are handled per request.
For a detailed explanation of the complete payment flow between clients and servers, see How x402 Works.
In the x402 protocol:
This interaction is stateless, HTTP-native, and compatible with both human applications and automated agents.
Next, explore: