HTTP/1.1 200 OK
date:
category:
zaklady
lang:
en · sk

What is x402? HTTP-native payments in one request flow

A concise guide to x402, the open payment protocol that lets clients and AI agents pay for internet resources over HTTP.

contents
  1. The basic exchange
  2. The participants
  3. Client
  4. Resource server
  5. Facilitator
  6. Why agents care
  7. What it does not solve
  8. Source of truth

x402 is an open protocol for internet-native payments. A resource server can describe the price of an API, file or computation in an HTTP 402 Payment Required response. A client authorizes the payment and retries the same request with a signed payload.

It is not a new payment network. It is a shared language between the client, the resource server and payment infrastructure.

The basic exchange

http
GET /v1/data HTTP/1.1
Host: api.example.com

HTTP/1.1 402 Payment Required
PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6Miwi...

In the current V2 wire format, the client returns a PAYMENT-SIGNATURE header. The server verifies the payload locally or through a facilitator, performs the paid operation, settles the payment and returns the resource.

The participants

Client

A program, application or AI agent that wants a paid resource and can authorize one of the payment options offered by the server.

Resource server

The HTTP service that prices and protects a resource. It remains responsible for authorization rules, product behavior and safe failure handling.

Facilitator

An optional service that verifies and settles payments for supported scheme and network combinations. A resource server can also perform these functions itself.

Why agents care

Traditional API access often requires account creation, prepaid credits, subscriptions and long-lived API keys. x402 can make price discovery and payment part of the same programmatic exchange as the resource request.

Traditional access x402-style access
Create an account Request the resource
Add billing details Receive machine-readable terms
Buy credits Authorize the exact interaction
Manage an API key Retry with the payment payload

This does not remove risk. Agents still need spending limits, domain trust policies, idempotency and an audit trail.

What it does not solve

x402 does not choose a price, guarantee the quality of a resource, make delivery and settlement automatically atomic, or replace tax and compliance work. Those remain product and operational responsibilities.

Treat a 402 response as an offer, not as proof that a service is trustworthy.

Source of truth

The x402 Foundation repository contains the open specification, SDKs and current payment-scheme documents. Check the exact protocol and package versions before building a production integration.