402 🌐 HTTP

HTTP 402 Payment Required

The service wants payment before it will process the request — an unpaid invoice, exhausted credits or a failed card.

Seen on: REST API

Meaning

402 was reserved for future use in the HTTP spec, but many APIs use it: Stripe returns 402 for declined cards (card_error), Vercel/Netlify/Shopify when a plan limit or invoice is unpaid, and AI/SaaS APIs when credits run out.

Common causes

  • Card declined (Stripe card_error)
  • Account billing overdue or trial expired
  • Prepaid credits/quota exhausted
  • Feature requires a paid plan

⚡ Quick fix

  1. Check the billing page or invoice for the account the API key belongs to
  2. Top up credits or update the payment method
  3. For Stripe, read error.decline_code and ask the customer for another card

Detailed fix by platform

Node.js

  1. javascript
    try { await stripe.paymentIntents.confirm(id); }
    catch (e) { if (e.statusCode === 402) console.log(e.code, e.decline_code); }

How to diagnose

  1. Account — Which account/key is being charged?
  2. Body — Error type/decline_code
  3. Billing — Overdue invoices or zero credit?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.