Join our Newsletter — 33% off our NHI Course

HTTP 402 Payment Required

HTTP 402 Payment Required is an HTTP status code reserved to indicate that a request cannot be fulfilled until payment is made. In practice, it is rarely used by general web servers, and applications that need billing controls usually define their own payment handling flow rather than rely on this status alone.

What HTTP 402 Means in Practice

HTTP 402 Payment Required is not a normal success path, it is a reserved status code that signals a request cannot proceed until payment or billing conditions are satisfied. Because general-purpose servers rarely standardise on it, teams usually treat it as a protocol hint rather than a complete business rule.

That distinction matters because the code alone does not define how payment is collected, how entitlement is granted, or how a client should retry. In production systems, those decisions usually sit in the application layer, where billing state, subscription status, order fulfilment and access policy can be expressed more precisely than a bare HTTP response.

Why 402 Is Rarely Used by Itself

HTTP status codes are best at describing transport-level outcomes, but payment is usually a business transaction with more context than an HTTP response can carry. A 402 response can tell the client that payment is needed, yet it cannot safely encode refund logic, invoicing, settlement state, regional tax handling, or which action a user should take next.

That is why many products reserve 402 for a narrow gate in a larger workflow, such as metered usage, subscription exhaustion, or a blocked premium feature. The application then decides whether to show a checkout flow, request a different plan, or deny the action permanently.

How Payment-Gated Workflows Usually Work

In a well-designed payment flow, the server separates billing enforcement from content delivery. The API or application checks whether the account, customer, or session has the right commercial status, then returns a response that the client can turn into a payment prompt, renewal request, or support message.

The control point is usually policy, not the status code itself. That policy may depend on subscription records, usage counters, purchase confirmation, or account state, and it often needs to be consistent across web, API, and mobile clients so that one channel cannot bypass the commercial gate.

Where HTTP 402 Can Be Useful

HTTP 402 is most useful when a product team wants a machine-readable signal that a request stopped for commercial reasons. It can be a clean way to distinguish billing failure from authentication failure, authorisation failure, or ordinary validation errors.

It is also useful as a design cue for API consumers. Clients can interpret the response as a prompt to surface a payment step, explain why access is blocked, or preserve the user’s work until the billing issue is resolved.

For teams defining agent-facing commerce or checkout flows, NHIMG’s Agent Payments Protocols Guide explains how payment mandates, delegated tokens, and trust boundaries fit into modern payment workflows.

Risk and Threat Considerations

Payment-gated responses can fail in ways that affect revenue, access control, and user trust. If a 402-like flow is loosely implemented, clients may cache the wrong state, retry endlessly, or misread a temporary billing issue as a permanent denial. Poorly designed payment gates can also be bypassed when the enforcement logic is inconsistent across endpoints.

Failure mechanism: The application treats the status code as the control itself instead of enforcing billing state server-side, or it applies the check in only one entry point while other paths still permit access.

Impact: Attackers or ordinary users may obtain unpaid access, automation may continue consuming services after entitlement expires, and support teams may struggle to tell whether the failure is commercial, operational, or security-related.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST SP 800-53 Rev 5 AC-3 — Access Enforcement 402-like billing gates enforce whether a request may proceed.
IA-5 — Authenticator Management Payment portals and gated APIs rely on managed credentials and tokens.
Recommendation — Enforce entitlement checks server-side before allowing paid actions. Protect and rotate credentials used in payment and subscription workflows.
OWASP API Security Top 10 API6 — Unrestricted Access to Sensitive Business Flows Payment-required flows are sensitive business processes that must be protected.
Recommendation — Protect checkout and renewal flows from bypass and automation abuse.

Practitioner Guidance

What to watch for: Use 402 only when the surrounding workflow can explain what payment means, what state changed, and what the client should do next. If the product cannot make those semantics clear, a more explicit application-level response is usually safer and easier to support.

Governance implication: Ownership should sit with the application and billing teams together, because the response code, the entitlement decision, and the customer experience all need to align. The HTTP layer can signal the condition, but the business system must remain the source of truth.