HTTP

HTTP 402 Payment Required vs 428 Precondition Required

Both HTTP 402 (Payment Required) and 428 (Precondition Required) belong to the 4xx Client Error category. 402 indicates that reserved for future use. Originally intended for digital payment systems, some APIs use it to indicate a billing or subscription issue. Meanwhile, 428 means that the server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.

Description

Reserved for future use. Originally intended for digital payment systems, some APIs use it to indicate a billing or subscription issue.

When You See It

On some APIs when a subscription has expired or payment is needed.

How to Fix

Check your billing status, update payment method, or upgrade your subscription.

Description

The server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.

When You See It

When an API requires optimistic concurrency control via ETags.

How to Fix

Fetch the resource first to get its ETag, then include If-Match in your update request.

Key Differences

1.

HTTP 402: Reserved for future use. Originally intended for digital payment systems, some APIs use it to indicate a billing or subscription issue.

2.

HTTP 428: The server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.

3.

You encounter 402 when on some APIs when a subscription has expired or payment is needed.

4.

You encounter 428 when when an API requires optimistic concurrency control via ETags.

When to Use Which

For 402 (Payment Required): Check your billing status, update payment method, or upgrade your subscription. For 428 (Precondition Required): Fetch the resource first to get its ETag, then include If-Match in your update request.

Learn More