402 Payment Required was reserved for future use and has no officially standardized meaning in HTTP. Even so, some APIs and SaaS products use it pragmatically to signal that payment or a credit top-up is needed.
It is adopted for "you must pay to continue" situations — exhausted free-tier quota, insufficient credits, an expired subscription. Since there is no standardized header convention, the specifics are usually placed in the response body.
POST /api/v1/generate HTTP/1.1
Host: api.example.com
Authorization: Bearer sk_live_...HTTP/1.1 402 Payment Required
Content-Type: application/json
{"error":"quota_exceeded","message":"Free tier limit reached","upgrade_url":"/billing"}app.use('/api', (req, res, next) => {
if (account.creditsLeft <= 0)
return res.status(402).json({ error: 'quota_exceeded', upgrade_url: '/billing' });
next();
});