Error codes
Every ExtensionBill error code, its HTTP status, what it means and how to fix it.
Every ExtensionBill API (SDK endpoints, Server API, hosted pages, dashboard) reports errors the same way. Codes are lowercase snake_case strings that never change once published, so your code can branch on them.
Error format
{
"statusCode": 409,
"code": "seat_limit_reached",
"message": "This license key is already active on 3 of 3 devices.",
"details": {
"seatLimit": 3,
"seatsUsed": 3
}
}
| Field | Description |
|---|---|
statusCode | The HTTP status, repeated in the body. |
code | Stable machine-readable code. Branch on this. |
message | Human-readable English text. Fine for logs; the wording may change, so don’t match on it. |
details | Optional extra data for some codes (listed in the tables below). |
Global errors
Any endpoint can return these.
| Code | HTTP | Meaning | Fix |
|---|---|---|---|
validation_error | 400 | A body field or query parameter is invalid. details is an array of messages, one per field. | Fix the listed fields. In the SDK this usually means a wrong argument type. |
bad_request | 400 | Malformed request: invalid JSON, a missing or invalid X-Env header on dashboard calls. | Check the request format. |
unauthorized | 401 | Dashboard or customer portal call without a valid session. | Sign in again. |
forbidden | 403 | Valid credentials, but not allowed to perform this action. | Use an account or key that has access. |
not_found | 404 | The record does not exist, or belongs to another app or environment. | Check the id and the environment (sandbox or live). |
conflict | 409 | The request conflicts with the record’s current state (for example a duplicate discount code). | Re-read the record and retry with updated values. |
unprocessable_entity | 422 | Well formed, but cannot be applied. | Read message for the reason. |
rate_limited | 429 | Too many requests. details.retryAfterSec and the Retry-After header give the wait. | Wait, then retry. See Rate limits. |
internal_error | 500 | Unexpected server error. | Retry with backoff. If it persists, contact support with the time of the request. |
paypal_error | 502, or PayPal’s 4xx | A call to PayPal on your behalf failed. 502 when PayPal is unreachable, returns a 5xx, or rejects your credentials (PayPal 401). PayPal’s status (400, 404 or 422) when PayPal rejects the request content. details has paypalDebugId, plus paypalName when sent. | On 502, retry later and check Settings → PayPal: the credentials may have been revoked or rotated in PayPal sandbox apps or PayPal live apps. On 4xx, read paypalName and message. Quote paypalDebugId to PayPal support. |
SDK and Server API errors
| Code | HTTP | Meaning | Fix |
|---|---|---|---|
invalid_publishable_key | 401 | The pk_… key is unknown or was rolled. | Copy the current key from Developers → Integrate and ship an update. |
invalid_install_token | 401 | The install token stored in the extension is not recognized for this app and environment, for example after switching between pk_test_… and pk_live_… during development. | The SDK registers the install again once and retries. If that also fails, remove and reload the extension. |
invalid_api_key | 401 | Server API: the sk_… key is missing, malformed or revoked. | Create a key in Developers → API keys. Check you did not send a pk_… key. |
extension_not_allowed | 403 | The extension ID is not in the app’s allowed extension IDs. | Add the ID (including your unpacked development ID) in Settings → General, or clear the list. See the FAQ. |
live_not_enabled | 403 | A pk_live_… key was used before the app is live. | Finish the Going live checklist and turn on Go live in Setup. |
license_not_found | 404 | bill.activateLicense() or GET /v1/licenses/:key/validate: no such key in this environment. | Check for typos, and that sandbox keys are used with pk_test_…. |
license_revoked | 409 | bill.activateLicense(): the key was revoked manually or by a full refund. | Tell the user to contact you. You can reinstate it from Licenses. |
license_expired | 409 | bill.activateLicense(): the key is past its expiry date. | Offer a renewal, or extend the key from Licenses. |
seat_limit_reached | 409 | bill.activateLicense(): all seats are used. details: seatLimit, seatsUsed. | The user frees a seat in the customer portal (bill.openPortal()), or you raise the seat limit or remove an activation in Licenses. |
trial_unavailable | 409 | bill.startTrial(): trials are disabled, or this install already used its trial. | Show the trial button only when user.trial.available is true. |
paypal_not_connected | 409 | Checkout, catalog sync, refunds or another call that needs PayPal, for an environment with no PayPal connection. | Connect PayPal for that environment in Settings → PayPal. See Connect PayPal. |
Checkout errors
The hosted checkout page returns these. Buyers see a friendly message; you mostly meet them while testing.
| Code | HTTP | Meaning | Fix |
|---|---|---|---|
checkout_not_found | 404 | The checkout session does not exist. | Start a new checkout with bill.openCheckout(). |
checkout_expired | 410 | The session is older than 24 hours. | Start a new checkout. |
checkout_completed | 409 | The session was already paid. | Nothing to do. Call bill.refresh() in the extension. |
discount_invalid | 400 | The discount code does not exist, is inactive, expired, used up, or does not apply to the selected price. | Check the code in Discounts. |
price_unavailable | 400 | The price is inactive, archived, or not synced to PayPal in this environment. | Activate the price, or run Sync on the product in Products. |
paypal_amount_mismatch | 409 | The amount or currency PayPal captured differs from what ExtensionBill computed. The order is not marked paid. | Review the order in PayPal and refund it if needed. Contact support if it repeats. |
payment_declined | 402 | PayPal denied the capture (for example a declined card). No order is paid and order.payment_failed is sent. | The buyer picks another funding source in the PayPal buttons and tries again. |
plan_limit_reached | 402 | Live only: this month’s ExtensionBill Free plan sales are used up, so new live checkouts are refused until the month resets. details: limit, grace, resetsAt. Buyers see a generic “try again later” message. | Choose a plan in the dashboard under Plan & usage. |
plan_payment_overdue | 402 | Live only: the payment for your ExtensionBill plan is overdue, so new live checkouts are refused. | Settle the payment in Plan & usage. |
Customer portal and restore errors
| Code | HTTP | Meaning | Fix |
|---|---|---|---|
otp_invalid | 400 | Wrong email code in the customer portal or restore page. | Re-type the code from the latest email. |
otp_too_many_attempts | 429 | 5 wrong codes for the same challenge. | Request a new code. |
otp_expired | 410 | The code is older than 10 minutes. | Request a new code. |
Dashboard errors
| Code | HTTP | Meaning | Fix |
|---|---|---|---|
go_live_blocked | 400 | Go live was turned on with checklist items open. details.checks lists each check with ok. | Fix the failing checks in Setup. See Going live checklist. |
cws_unreachable | 422 | The Chrome Web Store listing could not be fetched on import. The extension ID is still taken from the URL. | Enter the name and icon manually. |
paypal_sync_failed | 502 | Syncing a product or price to PayPal failed. | Retry Sync on the product in Products later. |
refund_exceeds_amount | 409 | The refund is more than the order’s remaining refundable amount. | Lower the amount. Earlier partial refunds count toward the total. |
subscription_not_active | 409 | Cancel, pause, resume or price change on a subscription whose state does not allow it. | Sync the subscription and check its status. |
SDK-only errors
Raised inside the SDK when there is no usable server response. Same ExtensionBillError class; status is 0 unless noted.
| Code | Status | Meaning | Fix |
|---|---|---|---|
network_error | 0 | The request could not reach ExtensionBill (offline, DNS failure, blocked by another extension or a firewall). | Show an offline message and retry later. Cached access keeps working until the entitlement token expires. |
timeout | 0 | ExtensionBill did not answer within timeoutMs. | Retry later. |
invalid_response | HTTP status | The body was not the expected JSON (for example a proxy or captive-portal page). | Retry later; check the user’s network. |
unsupported_context | 0 | The SDK ran outside an extension page, or bill.startBackground() ran outside the background service worker. | Call startBackground() only at the top level of the service worker, and use the SDK only in extension contexts. |
background_unavailable | 0 | A popup, options page or content script called the SDK, but the service worker never called bill.startBackground(). | Set up the background as in the Quickstart. |
invalid_argument | 0 | A method got an argument of the wrong type or shape (for example an empty license key). | Fix the call; see the SDK reference. |
storage_error | 0 | Reading or writing chrome.storage.local failed (for example quota exceeded). chrome.storage.sync failures are ignored. | Make sure "storage" is in the manifest’s permissions. |
extension_api_error | 0 | A browser extension API the SDK uses (tabs, runtime messaging, alarms) threw or set runtime.lastError. | Check err.message and the console; confirm your manifest permissions. |
invalid_publishable_key | 0 | Thrown synchronously by ExtensionBill() when publishableKey does not start with pk_test_ or pk_live_. | Pass the key exactly as shown in Developers → Integrate. |
When a server error response has no code, the SDK derives it from the HTTP status with the global codes: a bare 404 becomes not_found, a bare 429 becomes rate_limited.
Errors in the SDK
SDK methods that talk to ExtensionBill reject with an ExtensionBillError, which extends Error with code, status (the HTTP status) and details (the response’s details, or undefined).
bill.hasAccess() is synchronous and never throws. bill.getUser() falls back to the cached state while it is still valid, so a short outage does not reject it (see Caching and offline grace).
// popup.js
import { ExtensionBillError } from '@extensionbill/sdk'
import { bill } from './bill.js'
const form = document.querySelector('#license-form')
const message = document.querySelector('#license-message')
form.addEventListener('submit', async (event) => {
event.preventDefault()
const key = form.elements.key.value.trim()
try {
const user = await bill.activateLicense(key, 'This browser')
message.textContent = `Activated ${user.plan?.name ?? 'your license'}.`
} catch (err) {
if (!(err instanceof ExtensionBillError)) throw err
switch (err.code) {
case 'license_not_found':
message.textContent = 'That key does not exist. Check for typos.'
break
case 'license_revoked':
message.textContent = 'This key has been revoked. Contact support.'
break
case 'license_expired':
message.textContent = 'This key has expired.'
break
case 'seat_limit_reached':
message.textContent = `This key is already used on ${err.details.seatsUsed} of ${err.details.seatLimit} devices. Remove one in the customer portal.`
break
case 'rate_limited':
message.textContent = `Too many attempts. Try again in ${err.details?.retryAfterSec ?? 60} seconds.`
break
case 'network_error':
case 'timeout':
message.textContent = 'You appear to be offline. Try again.'
break
default:
message.textContent = 'Something went wrong. Please try again.'
console.error(err.code, err.status, err.message, err.details)
}
}
})
Rate limits
Rate-limited requests return 429 rate_limited with a Retry-After header (seconds) and the same value in details.retryAfterSec:
{
"statusCode": 429,
"code": "rate_limited",
"message": "Too many requests. Try again later.",
"details": { "retryAfterSec": 42 }
}
| What | Limit |
|---|---|
| Install registration (SDK) | 30 per minute per IP |
| Public checkout changes (select, discount, details, PayPal order/capture) | 60 per minute per IP |
| Email codes (portal and restore) | 5 sends per 15 minutes per email and app; 5 attempts per code; codes valid for 10 minutes |
| PayPal credential validation (dashboard) | 20 per 5 minutes per user |
In the SDK, a rate-limited call rejects with code: 'rate_limited' and err.details.retryAfterSec. From your backend, honor Retry-After instead of retrying in a tight loop:
// extensionbill-request.js
const API_BASE = 'https://api.extensionbill.com'
export async function extensionBillRequest(path, init = {}, maxAttempts = 3) {
for (let attempt = 1; ; attempt++) {
const response = await fetch(`${API_BASE}${path}`, {
...init,
headers: {
Authorization: `Bearer ${process.env.EXTENSIONBILL_SECRET_KEY}`,
'Content-Type': 'application/json',
...init.headers,
},
})
if (response.ok) return response.status === 204 ? null : response.json()
const error = await response.json().catch(() => ({ code: 'internal_error', message: response.statusText }))
const retryable = response.status === 429 || response.status >= 500
if (!retryable || attempt >= maxAttempts) {
throw Object.assign(new Error(error.message), { code: error.code, status: response.status, details: error.details })
}
const retryAfterSec = Number(response.headers.get('Retry-After')) || error.details?.retryAfterSec || 2 ** attempt
await new Promise((resolve) => setTimeout(resolve, retryAfterSec * 1000))
}
}
Still stuck? Common problems and fixes are in the FAQ.