x402 HTTP Payments for AI Agents
How x402 uses HTTP 402 and signed payment headers, what facilitators do, and why a site needs a priced machine resource before adoption.
Price comes first.
x402 places that price on an HTTP resource: the initial request receives 402 Payment Required with exact terms, and the client retries with signed payment data. Successful verification and settlement let the server return the promised resource. The exchange fits a paid API call or download because money stays in the request path, but middleware is credible only after the operator controls a receiving account and can bind one accepted payment to one durable fulfillment result.
The x402 Foundation repository currently documents protocol version 2. This is an open project specification, not an IETF RFC. Its design reaches other transports, while the HTTP binding remains the part an origin-readiness check can observe.
The three HTTP headers carry the payment exchange
An unpaid request receives 402 Payment Required. In x402 v2, the canonical payment description is a base64-encoded PaymentRequired object in the PAYMENT-REQUIRED response header. The object identifies the resource and provides an accepts array.
Each accepted option states the payment scheme, network, asset, amount, destination, and maximum completion time. Network identifiers use CAIP-2 form, such as an EVM chain namespace and reference. Amounts use atomic units, so a UI or agent must know an asset's decimals before presenting a human-readable price.
The client selects an accepted option, constructs the scheme-specific authorization, and retries the original request with PAYMENT-SIGNATURE. That header carries a base64-encoded PaymentPayload, including the selected terms and signed data. The server must compare the submitted choice with the terms it issued. A valid signature over a different recipient or amount cannot satisfy the quoted requirement.
After successful settlement, PAYMENT-RESPONSE carries a base64-encoded settlement result. Depending on the scheme, that can include the payer, network, amount, and transaction reference. The application response body remains the resource server's concern. See the Foundation's HTTP transport specification for the current wire format.
HTTP/1.1 402 Payment Required
PAYMENT-REQUIRED: <base64 PaymentRequired>
GET /paid-resource HTTP/1.1
PAYMENT-SIGNATURE: <base64 PaymentPayload>
HTTP/1.1 200 OK
PAYMENT-RESPONSE: <base64 SettlementResponse>
A plain 402 without x402 payment terms does not implement the protocol. Nor does a successful Bazaar discovery request prove that a particular origin protects a route. Test the resource itself and decode the headers.
A facilitator handles payment operations, not product delivery
A resource server can implement scheme verification and network settlement itself. Most teams will evaluate a facilitator instead. The current facilitator interface exposes /verify to check a payload without broadcasting it, /settle to execute settlement, and /supported to describe supported combinations.
The x402 facilitator documentation calls the service optional and recommends choosing a production provider that supports the intended mainnet, or operating the function directly. The public x402.org facilitator is described as a development and testnet path. Treating that public service as an assumed production dependency would skip vendor review and availability planning.
Verification should confirm the signature, amount, recipient, asset, time window, network, and scheme rules. Settlement then submits the authorized transaction. The facilitator returns a result, but the resource server decides whether to release the resource and records what it released.
That last part can't be delegated away. If settlement succeeds and rendering the paid report fails, support staff need a recovery path. If the facilitator times out after broadcasting, the server must determine whether funds moved before attempting again. Define those states before real money enters the route.
Wallet, network, and asset choices become production configuration
The receiving address must belong to the business. Verify it out of band, separate test and production configuration, and make a second person confirm any change. A typo in payTo can send funds to an unrecoverable destination while every HTTP check still passes.
Network selection affects finality, fees, asset availability, and facilitator support. Asset selection adds decimal handling, treasury custody, conversion, and accounting questions. A team that prices a resource in dollars but receives a token must decide when a quote expires and who absorbs price movement.
Client controls matter too. An agent-capable client should enforce a maximum amount, approved assets and networks, permitted merchants, and a per-period budget before signing. The server cannot assume that machine payment means unlimited delegated authority.
Keep wallet keys and facilitator credentials out of route code and logs. Rotate secrets, restrict outbound facilitator destinations, cap request sizes, and avoid recording complete payment payloads when a transaction reference and internal correlation ID are enough for support.
Replay protection and idempotency solve different problems
The EVM exact scheme described by x402 uses a unique nonce and validity interval. The token contract rejects nonce reuse after the authorization is consumed. Other schemes define their own replay controls.
Application retries still need a separate answer. Imagine a paid POST that generates an export and stores it. The client loses the HTTP response, retries, and presents a payment that the server has already settled. The server should return the original export or a stable status, not charge again and start a second job.
Bind an application operation ID to the quoted terms, payment reference, settlement state, and fulfillment result. Enforce uniqueness in durable storage. The x402 Payment-Identifier extension can carry an operation identifier where both parties support it, but the application still owns atomic fulfillment and retry behavior.
No priced route exists on this site
TKOResearch publishes TARE product information, engineering articles, and private client service information. The contact endpoint accepts inquiries. No public route sells a defined machine resource at a posted per-request price.
Putting x402 in front of /api/contact would charge for intake without a product decision, support policy, or refund contract. Putting it in front of an article would invent a sales model that the site doesn't operate. Public pages should keep returning ordinary successful responses, and the contact workflow should remain outside payment middleware.
A future TARE API could make a different choice for one bounded operation. The release question would be concrete: what does one successful request buy?
The first paid route decides the design
Before x402 appears in production, write a release record around that route. Four parts deserve direct answers:
- Define the fulfillment result for success, timeout, and partial failure, along with the request schema, authentication policy, service objective, error contract, and idempotency key.
- Publish the amount in atomic units, quote lifetime, taxes, usage limits, scheme, network, asset, receiving wallet, facilitator, confirmation rule, and reconciliation owner.
- Connect the application operation ID, payment reference, retry result, support case, and any refund or service credit without placing credentials in logs.
- Test key custody, recipient changes, client budgets, replay controls, rate limits, dependency failures, duplicate requests, settlement ambiguity, facilitator latency, and recovery.
That record would turn a 402 response into a supported TARE product contract. The current site has no such route, so adding the header would be fiction rather than readiness.
