When an error occurs on API request, Klarna responds with an error type, an error code, an error message and a corresponding HTTP status code.
Klarna’s APIs use HTTP status codes together with error objects to handle errors. When an API call fails Klarna will respond with a 4xx
or 5xx
status code together with a response body containing an error object with the error code, an array of error messages and a unique error id to be used to identify the request.
Parameter | Definition |
---|---|
| A unique identifier for the request generated by Klarna. This ID will help you in investigations in case you need help from our support team. |
| Type of the error. Different error types are ACCESS_ERROR , TECHNICAL_ERROR , RESOURCE_ERROR and INPUT_ERROR . |
| Error code for further categorizing the error. We recommend using this error code for building your error handling logic. |
| A human readable error message. The error message is not meant to be displayable to customers shopping, but to assist in technical troubleshooting. |
| Link to Klarna docs describing how to use the API to avoid the error, or a more detailed explanation of why the error occurred. To be provided when available. |
Example of API response with an error details:
"error_id": "abcd1234-12ab-1234-abcd-abcd12345678",
"error_type": "INPUT_ERROR",
"error_code": "VALIDATION_ERROR",
"errors": [
{
"parameter": "line_items[0].quantity",
"error_message": "Parameter line_items[0].quantity must be greater than or equal to 1",
"doc_url": "https://docs.klarna.com/....."
}
]}
Error type | Error code | HTTP Status code | Definition | Handling |
---|---|---|---|---|
|
| The requested API route does not exist. | Verify the API route. | |
|
|
| The presented credentials failed authentication. | Verify the credentials, check the authentication method, and confirm the correct endpoint. |
|
| The caller was rate limited due to too many requests. | See Rate Limiting for more details. | |
|
|
| The resource was not found. | Verify the token provided in the request path. This issue may also occur if an attempt is made to update an expired shopping session. |
|
| There was a conflict in using the resource. | The transaction details are conflicting with the request details. Might occur due to concurrent updates to the resource. | |
|
| The provided credentials (authorization) does not have enough privileges to perform the requested operation. | Ensure that the credentials being used have the necessary permissions for the operation. | |
|
| The specific resource was rate limited. For example creation of resources are rate limited, but it is still possible to run on already existing resources. | See Rate LimitingAPI for more details. | |
|
|
| One or more input parameters failed input validation. For example exceeding a max value, or failed pattern matching, invalid type. | Verify that the request details and formats are correct. See the error message for more info. |
|
| The input does not conform to the expected content type syntax. For example invalid JSON. | Verify that the content type is as expected. | |
|
|
| An unknown error occurred. | Reach out to your support contact and include the error message and the error id. |
|
| The system is misconfigured. For example, price plan is misconfigured. | Reach out to your support contact and include the error message and the error id. | |
|
| The system is temporarily unavailable to process the request. | Reach out to your support contact and include the error message and the error id. |