Errors

Errors come back with an HTTP status and an error object. Branch on type and code: they're stable. message is written for people and may change. param names the field the error is about, and doc_url links to the code's entry below. See API basics for the full shape.

Types

TypeStatusMeaning
invalid_request_error400, 404, 409The request was wrong: a bad field, an unknown ID, or a conflict with the object's state.
authentication_error401The API key is missing, invalid or revoked.
permission_error403The key can't do this.
card_error402The card or bank declined.
rate_limit_error429Too many requests. Wait for the time in the Retry-After header.
processor_error502The payment network didn't answer or refused. The message says what happened and what to do.
api_error500A problem on our side.

Codes

CodeStatusMeaning
parameter_missing400A required field is missing, or the request needs a body and had none.
parameter_invalid400A field has the wrong type or breaks a limit: a decimal or string amount, an ID with the wrong prefix, a value not in the allowed list, metadata over its limits.
parameter_unknown400The request has a field or query parameter this endpoint doesn't take.
invalid_json400The body isn't valid JSON.
invalid_body400The body is JSON but not an object, such as an array or a string.
resource_missing404No object with that ID exists in this account and mode. A test-mode ID isn't visible to a live key, and the other way round.
idempotency_key_reused409This Idempotency-Key was used in the last 24 hours with different parameters.
idempotency_key_in_use409The first request with this Idempotency-Key is still running.
card_declined402The card or bank declined. decline_code says why when the issuer told us, and charge is the failed charge's ID.
charges_not_enabled400This account can't take live payments yet: its application isn't approved.
charge_not_capturable409Only a charge in requires_capture can be captured.
charge_not_cancelable409Only an uncaptured authorization can be canceled.
charge_not_refundable409Only a succeeded charge can be refunded.
charge_already_refunded409The charge has been refunded in full.
partial_refund_unsupported400Bank account payments can only be refunded in full.
payment_method_attached409The payment method belongs to another customer.
processor_unavailable502The payment network didn't answer in time, so the outcome isn't known yet. For a charge or refund, the object exists with status unknown or pending and resolves on its own, with an event.
capture_failed502The capture was refused or got no answer.
cancel_failed502Releasing the authorization was refused or got no answer.
refund_failed502The refund was refused. The refund object is marked failed.
detach_failed502The saved payment method couldn't be removed. It is still attached.
invalid_api_key401The key is missing, malformed, revoked or expired.
account_missing401The key belongs to an account that no longer exists.
publishable_key403A publishable key (pk_…) was used where a secret key is needed.
secret_key_required403A publishable key tried to save a payment method to a customer, or to allow off-session use.
account_required403A platform key was used without naming the account to act on.
insufficient_role403Your role on the account can't do this (dashboard).
reauthentication_required403Sensitive dashboard actions, such as refunds and new keys, need your second factor within the last ten minutes.
insufficient_scope403The restricted key (rk_…) doesn't have the permission this request needs: read for GET requests, write for the rest.
product_has_prices400The product has prices, so it may be on invoices or subscriptions, and can’t be deleted.
invoice_empty400The invoice has no lines, or adds up to nothing, so it can’t be finalized.
invoice_not_draft400The invoice is finalized, so its lines and settings can’t change any more.
invoice_not_open400Only an open invoice can be voided or marked uncollectible.
invoice_has_payments400Payments were made on the invoice, so voiding it would lose track of them.
test_mode_recipient400In test mode, invoices can only be emailed to people on your team.
email_failed502The email couldn’t be handed to our mail service. Nothing was marked as sent.
partial_payments_not_allowed400The invoice must be paid in full, and amount was less than what’s owed.
amount_too_small400The payment is less than the invoice’s minimum_payment.
amount_too_large400The payment is more than the invoice still owes.
payment_pending409A payment on the invoice hasn’t been confirmed yet, and it may have gone through.
too_many_payment_attempts429Too many payments on this invoice failed in the last hour.
installments_total_mismatch400The installments don’t add up to the invoice’s total.
member_exists400That person is already on the account’s team (dashboard).
cannot_change_self400Nobody can change their own role or remove themselves from a team (dashboard).
last_owner400An account always keeps at least one owner (dashboard).
member_managed_externally400This person’s access comes from Core Labs, which updates it at every sign-in.
internal_error500Something went wrong on our side.
processor_not_configured500The account's payment setup isn't finished on our side.
encryption_not_configured500Webhook endpoints aren't available in this environment yet.
operation_unspecified500A bug on our side: the endpoint is missing from our API description.

Decline codes

On a card_declined error, decline_code says why, when the issuer told us. Show the customer message, not the code, and ask for another payment method.

Decline codeMeaning
insufficient_fundsThe card doesn't have enough funds or credit.
expired_cardThe card has expired.
incorrect_cvcThe security code doesn't match.
card_declinedThe issuer declined and didn't say why.