Errors
Every error has the same shape. Branch on type and code; show message to a developer, not a buyer.
{
"error": {
"type": "invalid_request_error",
"code": "validation_failed",
"message": "providers: Not connected: stripe.",
"param": "providers",
"request_id": "01a1…"
}
}param names the field at fault, when there is one, and a field's message begins with its name. Quote request_id to support; it's also in the X-Request-Id header.
Types
| Type | Status | Meaning |
|---|---|---|
invalid_request_error | 400, 404, 409, 410 | Something about the request: a field, an ID, or the state of what it asks to change |
authentication_error | 401 | No key, or not a valid one |
permission_error | 403 | A valid key that can't do this, or a website that isn't allowed |
idempotency_error | 409 | An Idempotency-Key reused for a different request |
rate_limit_error | 429 | Too many requests; wait Retry-After seconds |
api_error | 5xx | On ShipBill's side; safe to retry with the same Idempotency-Key |
Codes
| Code | When |
|---|---|
validation_failed | A field is missing or wrong. param names it, such as line_items.0.product. |
unauthenticated | No key, a malformed or unknown key, or a revoked one. |
secret_key_required | A publishable key was used where only a secret key may act. |
publishable_key_required | A secret key was used on a browser endpoint (/v1/embed). Never put a secret key in a page. |
origin_not_allowed | A browser request from a website not in Payments → Website integration → Allowed websites, or one the list can't hold (a page opened from a file, a LAN address over http), or localhost in live mode, which opens test checkouts only. The message says which. A buy button there shows the buyer a short sentence, and an embedded checkout opens as its own page instead of over yours; both call your onError first. A price preview from there is refused. |
embed_not_allowed | The checkout was opened over a different allowed website first; it stays with that one. |
not_found | No object with that ID in this profile and mode. Test keys never see live data. |
customer_has_provider_subscriptions | Erasing a customer a provider still charges on its own (a subscription it renews automatically). Cancel it at the provider, then erase them. |
rate_limited | Too many requests. Wait for Retry-After seconds; the libraries do this for you. |
idempotency_key_reused | An Idempotency-Key was sent again with a different request. Use a new key for a new request. |
checkout_unavailable | This profile can't take payments now: no payment provider is enabled in this mode, none of the providers the product allows is, or the account is locked. Connect one in Settings → Payment providers; in test mode the built-in Test provider works without an account. |
method_unavailable | The payment method asked for can't take this checkout: no enabled provider offers it for this buyer, currency, or amount. Offer another method, or connect a provider that takes it. |
currency_unavailable | ShipBill doesn't support that currency. |
items_unavailable | A checkout of several products, or several of one, that no enabled payment provider in its mode can take together: products limited to providers that share none, or a set needing a copy at providers (Polar, Creem) that already keep their 50. The message says which, on line_items. Let the products use a provider in common, enable another, or sell them separately. |
quantity_unavailable | The buyer's quantity outside the range the product allows on its payment link's or buy button's checkout, or on a checkout whose quantity is fixed. |
custom_amount_unavailable | A custom amount in a mode where every enabled provider is a merchant of record. A merchant of record is the legal seller and sells only products it reviewed, so none takes one. Send line_items with a product, or connect a provider that takes a custom amount: Hosted checkout's Custom amounts section lists which do. |
no_discount | Ending a subscription's discount (DELETE /v1/subscriptions/{id}/discount) when it has none: bought without a coupon, its periods used up, or already ended. |
discount_not_endable | Ending a subscription's discount at a provider that renews it and can't remove one (Creem, Whop). The message says when it runs out. Those providers aren't sent a subscription whose coupon lasts past the first payment. |
addon_not_changeable | Dropping or adding a subscription's recurring add-on (POST /v1/subscriptions/{id}/addons/{product}) when it can't be changed: the subscription isn't running or is set to end, the product is its own or not one of its recurring add-ons, or the add-on has no price in its currency. The message says which. |
coupon_not_applicable | The code in discounts doesn't apply to this checkout: unknown or archived, outside its dates, used up, not for these products or this currency, or on a custom amount. reason says which. |
session_not_expirable | The checkout is being paid or is already complete, so it can't be expired. |
payment_intent_not_cancellable | The payment intent is paid, or a payment on it is under way at the provider, so it can't be cancelled. |
invoice_not_voidable | The invoice is paid or partly paid. |
invoice_pdf_pending | The invoice's PDF is still being drawn. Try again in a few seconds. |
subscription_not_renewable | The subscription can't be renewed now, such as one cancelled and already ended. |
webhook_url_rejected | The endpoint address isn't a public https address on port 443. |
webhook_endpoint_limit | There are already ten endpoints in this mode. |
payload_too_large | The request body is too large. |
internal_error | Something failed on ShipBill's side. Retry; quote request_id if it persists. |