Skip to main content

errors

This guide is only for response errors in our API. If you are looking for help with some other kind of error and can't find the solution within the documentation, send us an email to ayuda@wompi.co

The Wompi API handles errors in a clear and consistent way in all the scenarios that could potentially show up. The errors have been designed to give the developer quick feedback about the errors that he could be making. The structure is simple, with a few cases that cover all the scenarios in a way that they are intuitive to read and understand.

Error with 401 status code

A 401 error with a type "INVALID_ACCESS_TOKEN" is generated when there is an authentication error with the private/public key. The field "reason" gives us more details about what generated the error.

In the next example we will see an error that originates when using a Sandbox key on the Production environment. Reason specifies the reason for the error.

// Status 401 Unauthorized
{
"error": {
"type":"INVALID_ACCESS_TOKEN",
"reason":"La llave proporcionada no corresponde a este ambiente."
}
}

Error with 404 status code

A 404 error with type "NOT_FOUND" is generated when a request for information to a specific inexistent entity is sent.

For example, by sending a GET to the endpoint /v1/transactions/{transaction_id} with an ID for the wrong transaction, we would get the following:

// Status 404 Not Found
{
"error": {
"type":"NOT_FOUND_ERROR",
"reason":"La entidad solicitada no existe"
}
}

Error with 422 status code

A 422 error code with type "INPUT_VALIDATION_ERROR" is attributable to one or more entry fields. The fields to which the error is attributed to and it's corresponding explanaition are specified in the property "messages" within the JSON body.

Next we see an example of an error that is returned when a reference has been previously utilized when creating a transaction. We see that messages is found in a has specified in reference, an array with the errors that are found in the that field.

// Status 422 Unprocessable Entity
{
"error": {
"type": "INPUT_VALIDATION_ERROR",
"messages": {
"reference": [
"La referencia ya ha sido usada"
]
}
}
}