{error, code} shape used in earlier docs has been replaced. See the migration note below if you have older code.
Fields
Error types
Useerror.type to route an error to the right handler. Each type maps to a typed exception class in the SDKs.
HTTP status codes
Error codes
Authentication
Resources
Billing
Other billing rule violations return a descriptive
error.message with error.type set to invalid_request_error and the HTTP status shown, without a dedicated error.code today. This covers a missing plan, coupon, promotion code, or customer (404), an inactive coupon or expired promotion code, and a subscription that is not in an active state (409 or 422). Branch on error.type and the HTTP status, and read error.message. Dedicated billing codes are being added incrementally.Plans, quotas, and availability
These are the gates paying merchants hit as they grow. Each carries extra fields for programmatic handling.Validation + rate limiting
The account_suspended error
When your account is suspended, every API request returns 403 account_suspended - including read-only endpoints. Hosted checkout pages and payment links also stop working.
Handling errors in code
Migrating from the flat envelope
If you have integration code written before the new envelope, here is the upgrade path. The change is breaking - upgrade your SDK and any direct error parsing in lockstep.Old shape
New shape
What changed
erroris now an object instead of a string. Readingresponse.errordirectly will give you[object Object]instead of the message.- Read
response.error.messagefor the human-readable string,response.error.typefor the broad category,response.error.codefor the specific identifier. code: "unauthorized"was generic - it has been split intoapi_key_missing,api_key_invalid,api_key_revoked,api_key_expiredso you can branch by failure mode.- Suspension fields previously at the top level (
suspended_at,suspended_reason) are now nested undererror.suspension. - All errors now include
error.request_idmatching theX-Request-Idresponse header. Quote it in support requests.