402

HTTP 402 Payment Required

4xx Client Error

4xx Client Error RFC 7231, Section 6.5.2

What is HTTP 402 Payment Required?

The 402 (Payment Required) status code is reserved for future use. While originally created for digital payment systems, it is not widely used. Some APIs use it to indicate that a paid subscription is required to access a resource.

Common Use Cases

  • Digital payment gateways
  • Subscription-based API access
  • Paywalled content services

Usage Example

When a client requests an API endpoint that requires a paid subscription, return 402 Payment Required. This clearly indicates the resource is available but requires payment, distinct from 403 Forbidden which suggests permission issues unrelated to payment.

// Laravel - subscription required
if (! $user->subscribed()) {
    return response()->json([
        'error' => 'Payment required',
        'upgrade_url' => route('billing.plans'),
    ], 402);
}

Common Mistakes

⚠️

Mistake: Using 403 Forbidden instead of 402 for paywalled content

Fix: If the reason for denial is specifically lack of payment (not lack of permission), use 402 Payment Required. This gives clearer semantics than 403 Forbidden, which implies a general authorization failure.

Last updated: 21 Jun 2026