2xx range indicate success, codes in the 4xx range indicate a client error, and codes in the 5xx range indicate a server error.
All errors return a JSON body with a consistent structure:
Error Types
| Type | HTTP Status | Description |
|---|---|---|
api_error | 500 | Something went wrong on our end. These are rare and indicate an internal problem. |
authentication_error | 401 | Invalid or missing API key. Verify your credentials. |
invalid_request_error | 400 / 404 | The request had invalid parameters or referenced a resource that does not exist. |
rate_limit_error | 429 | Too many requests hit the API too quickly. Back off and retry with exponential backoff. |
payment_error | 402 | Payment processing failed. The card may have been declined or the payment method is invalid. |
Error Codes
resource_missing
The requested resource does not exist.
- HTTP Status: 404
- Type:
invalid_request_error
parameter_invalid
A parameter provided in the request is invalid.
- HTTP Status: 400
- Type:
invalid_request_error
param field. Correct the value and retry.
parameter_missing
A required parameter is missing from the request.
- HTTP Status: 400
- Type:
invalid_request_error
param field. Consult the API reference for the endpoint to see all required parameters.
amount_invalid
The refund amount must be a positive integer.
- HTTP Status: 400
- Type:
invalid_request_error
amount field is a positive integer representing the smallest currency unit (e.g., cents for USD).
amount_too_large
The refund amount exceeds the amount available to refund on the charge.
- HTTP Status: 400
- Type:
invalid_request_error
amount_refunded and amount fields to calculate the remaining refundable amount. Pass an amount that does not exceed this value.
payment_intent_unexpected_state
The PaymentIntent’s current status does not allow the requested action.
- HTTP Status: 400
- Type:
invalid_request_error
status before performing the action. Only call confirm on intents with status requires_confirmation, and only call cancel on intents that have not yet succeeded.
invalid_state_transition
The requested status transition is not allowed for the PaymentIntent.
- HTTP Status: 400
- Type:
invalid_request_error
payment_not_initialized
The payment has not been initialized with the payment engine.
- HTTP Status: 400
- Type:
payment_error
idempotency_key_reuse
The same idempotency key was used with different request parameters.
- HTTP Status: 422
- Type:
invalid_request_error
internal_error
An unexpected error occurred on the server.
- HTTP Status: 500
- Type:
api_error