# HTTP 402 Payment Required — Meaning, Causes & Fixes

> Reserved for future use; some APIs use it to signal a billing problem.

402 was reserved in early HTTP for digital payment schemes that never materialised, and the spec still lists it as reserved. A few APIs use it to say the account needs to pay: Stripe returns 402 when a request fails despite valid parameters, such as a declined card, and some SaaS APIs use it when a trial or quota runs out.

- Class: 4xx Client Error
- Retry: No — change the request first
- Cacheable by default: no
- Defined in: [RFC 9110 §15.5.3 — 402 Payment Required](https://www.rfc-editor.org/rfc/rfc9110.html#section-15.5.3)

## Example response

```http
HTTP/1.1 402 Payment Required
Content-Type: application/json
Content-Length: 28

{"error":"Payment Required"}
```

## Common causes

- A payment API couldn't complete a charge (a card decline, for example).
- A subscription lapsed, or a paid feature was requested on a free plan.

## How to fix it

1. Read the error body — it usually names the billing reason.
2. Update the payment method or upgrade the plan in the provider's dashboard.
3. In your own API, prefer 403 with a clear error code unless your clients are known to handle 402.

## Send a 402 from your server

### Express

```
res.status(402).json({ error: "Payment Required" });
```

### Next.js route handler

```
return Response.json({ error: "Payment Required" }, { status: 402 });
```

### Flask

```
return {"error": "Payment Required"}, 402
```

### Go net/http

```
http.Error(w, "Payment Required", http.StatusPaymentRequired)
```

### nginx

```
return 402;
```

## FAQ

### Should I use 402 in my API?

It's allowed but has no standard meaning, so generic clients won't treat it specially. If you use it, document it and return a descriptive error body.

## Related status codes

- [403 Forbidden](https://www.devkult.com/http/403.md)
- [429 Too Many Requests](https://www.devkult.com/http/429.md)
- [401 Unauthorized](https://www.devkult.com/http/401.md)

Open the interactive page: https://www.devkult.com/http/402