Payment required

PAYMENT_REQUIRED with HTTP 402 is a reserved code. The API does not send it today.


What it means

No v3 route answers 402 at the moment. Plan limits are reported in other ways:

  • Monthly credits used up: RATE_LIMITED with limitType: "monthly".
  • A feature that is not in your plan: FORBIDDEN on the company routes. Everywhere else the block is left out of the response.

The code is listed so that clients are ready for new error codes. The list of codes can grow at any time.

Example response

This is how the body would look:

Response (402)

{
  "type": "https://docs.finlight.me/errors/payment-required",
  "title": "Payment required",
  "status": 402,
  "detail": "...",
  "code": "PAYMENT_REQUIRED",
  "requestId": "req-123"
}

How to fix

If you ever get this code:

  1. Check your plan and billing in the finlight dashboard.
  2. If everything looks fine there, contact support with the requestId.

Retry

Do not retry. Treat it like any error code you do not know: report it and stop.

In the SDKs

The client libraries have no special class for this code. It arrives as the base API error with apiKind other, and code is PAYMENT_REQUIRED. It is not retried.

LanguageError
TypeScript, PythonFinlightApiError
RubyFinlight::ApiError
.NET, Java, PHPFinlightApiException
Go*finlight.APIError with APIKind == finlight.APIKindOther
RustError::Api with api_kind() == ApiErrorKind::Other