HTTP 402 Payment Required
Informational
HTTP 402 is a status code reserved in the original HTTP specification for payment-related responses and left largely unused for three decades. Machine payment protocols have revived it: a server returns 402 to indicate a request requires payment, along with instructions the client can act on programmatically.
How it works
A client requests a resource. The server responds 402 with a machine-readable description of what payment is required and how to provide it. The client pays and retries, and the request succeeds. The exchange requires no human, which is what makes it usable by agents — and what makes an unexpected 402 an operational event rather than a browsing inconvenience.
Example
Northwind's agent requests a pricing endpoint and receives 402 with terms of $0.08 per call. The agent pays and retries. Repeated across March, that is 40,000 successful calls and $3,200 — one accounting event that never passed through a purchase order.
Common questions
What should I do when my agent gets a 402?
Distinguish an expected paywall from an error. If it is expected, the agent should pay within its authority and retry. If it is unexpected, the transaction should be refused and surfaced, because paying an unbudgeted request is worse than failing.
Does a 402 create an accounting obligation?
Not by itself. The obligation arises when payment is made and the service is delivered.