402
HTTPERRORNotable4xx Client ErrorHIGH confidence

Payment Required

Production Risk

Low. Its appearance is rare and specific to services that have chosen to implement it. It clearly communicates the need for payment.

What this means

Reserved for future use. The initial aim for creating this code was using it for digital payment systems, however this status code is used very rarely and no standard convention exists.

Why it happens
  1. 1An API has a rate limit or usage quota, and the user has exceeded their free tier.
  2. 2A service requires a subscription or one-time payment to access a specific resource.
  3. 3Some platforms, like the Stripe API, may use this to indicate a payment failure.
How to reproduce

A developer tries to access a premium feature of a SaaS API without a valid subscription.

trigger — this will error
trigger — this will error
GET /api/premium-feature HTTP/1.1
Host: saas.example.com
Authorization: Bearer <user_token>

expected output

HTTP/1.1 402 Payment Required

Fix

Provide Payment Details

WHEN Accessing a paid resource.

Provide Payment Details
Follow the service's instructions to provide a payment method or upgrade the account.

Why this works

User Action

Version notes

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All HTTP errors