Skip to content

Paddle Errors

github-actions[bot] edited this page Dec 2, 2026 · 2 revisions

Paddle Errors

Every failure from @tundraconnect/paddle is a PaddleError, including request-validation, response-validation and webhook-verification failures. Branch on the readonly code property, never on a message substring.

import { PaddleError } from '@tundraconnect/paddle/errors';

try {
  await paddle.getSubscription(id);
} catch (err) {
  if (err instanceof PaddleError && err.code === 'NOT_FOUND') {
    return null;
  }
  throw err;
}

Configuration codes

Code Raised when
CONFIG_INVALID_API_KEY auth is missing, isn't BEARER, or its token is blank.
CONFIG_INVALID_ENVIRONMENT environment is neither 'sandbox' nor 'live'.
CONFIG_ENVIRONMENT_MISMATCH The key's pdl_live_ / pdl_sdbx_ prefix names the other environment.

Request / response codes

Code Raised when
REQUEST_VALIDATION_ERROR Arguments failed local validation. Nothing was sent.
RESPONSE_ERROR A successful response's body didn't match the expected schema.
PAGINATION_STALLED A listAll* iterator got has_more with a cursor that did not advance.
TIMEOUT No complete answer within the timeout (context timeoutSeconds).
NETWORK_ERROR The request failed before any response (DNS, TLS, connection reset).

TIMEOUT, NETWORK_ERROR, SERVICE_UNAVAILABLE and RATE_LIMITED are transient: Paddle gave no definite answer, so the same call may succeed later. err.transient is true for exactly these, and false for every other code. The set is exported as PADDLE_TRANSIENT_CODES from @tundraconnect/paddle/errors.

Vendor codes

Classification is by HTTP status. Paddle's own error is kept in the context:

Context key Value
status HTTP status.
vendorCode Paddle's error.code, e.g. not_found, invalid_field.
vendorType request_error or api_error.
fieldErrors Paddle's error.errors, [{ field, message }], on a 400.
requestId meta.request_id. Quote it to Paddle support.
retryAfterSeconds The Retry-After hint on a 429, when sent.
HTTP code
400, 422 INVALID_REQUEST
401 AUTH_FAILED
403 FORBIDDEN
404, 410 NOT_FOUND
409 CONFLICT
429 RATE_LIMITED
5xx SERVICE_UNAVAILABLE
anything else UNKNOWN_ERROR

Typed getters

Besides code and transient, every PaddleError has two typed getters, so you don't have to read untyped context:

Getter Type Value
vendorCode string | undefined Paddle's error.code, such as entity_archived (the vendorCode context key). undefined when there was no vendor response or no code.
status number | undefined The HTTP status, or undefined for a timeout, network failure or local validation.

Branch on code; use vendorCode for logging or a vendor-specific case. Every payment connect has the same two getters.

Rate limits

Paddle allows 240 requests a minute per IP and blocks the IP for 60 seconds after a 429. Subscription immediate charges have their own caps (20 an hour, 100 a day per subscription), also answered with 429.

Pass maxRetryWait to let RESTler retry once when Paddle's Retry-After fits under it. When the retry is also refused, or the hint exceeds the cap, the client throws RATE_LIMITED with retried and retryAfterSeconds in the context.

Webhook codes

Code Raised when
WEBHOOK_INVALID_HEADERS No Paddle-Signature, or it has no ts= and h1= pair.
WEBHOOK_TIMESTAMP_INVALID ts is not a Unix time, or is outside toleranceSeconds.
WEBHOOK_SIGNATURE_INVALID No h1 matches. Treat the request as forged.
RESPONSE_ERROR The signature matched but the body is not a Paddle event.
REQUEST_VALIDATION_ERROR The secret passed in is blank.

Credentials never appear in an error's message or context.

Clone this wiki locally