What is HTTP 402 Payment Required?
HTTP 402 is a status code reserved in the HTTP specification for digital payment systems. Defined in HTTP/1.1 but never standardized — until x402 gave it purpose as the foundation for AI agent payments.
WHY IT MATTERS
When HTTP was written in the 1990s, the authors reserved 402 for web payments alongside 401 (Unauthorized) and 403 (Forbidden). But the tech wasn't ready — payments went through credit card gateways instead.
Decades later, stablecoins, programmable blockchains, and AI agents created the conditions for HTTP 402. The x402 protocol implements the original vision: a server responds 402 for "payment required," and the client (an AI agent) pays programmatically.
This enables true pay-per-request economics powered by agents processing payments at machine speed.
HOW POLICYLAYER USES THIS
As 402 enables protocol-level agent payments, PolicyLayer determines whether an agent should honor a payment challenge — evaluating each against spending policies before authorizing.