Errors

Curacel Grow uses the standard HTTP response codes to indicate if an API request was successful or not.

The standards are as follows:

  • Codes in the 2xx range, on the whole, suggest success.
  • Codes in the 4xx range indicate that an error occurred based on the data provided (For example, a charge failed, a needed parameter was left out, and so on.)
  • Codes in the 5xx range suggest that something went wrong on Curacel's end. (These are rare, we promise!).

In some cases, errors are handled automatically(e.g, when a card is declined, an error will be shown to highlight the issue and possibly offer information on how to fix it).

HTTP Response Status Codes

Status CodesDescription
1xxInformational
2xxSuccessful - Everything worked as expected.
3xxRedirection messages
4xxClient Error responses
5xxServer error responses

HTTP Response Status Codes Summary

Status CodesDescription
200 - OKEverything worked perfectly.
201 - CreatedAs a result of the request's success, a new resource was created.
400 - Bad RequestThe request was denied, usually because a required parameter was missing.
401 - UnauthorizedUnauthenticated because no valid API key was provided.
402 - Request FailedThe parameters were correct, however, the request did not succeed.
403The client does not have access rights to the content.
404 - Not FoundThe server can not find the requested resource. The link may be correct, but the resource does not exist.
409 - ConflictThis response is sent when a request conflicts with the current state of the server.
422 - Unprocessable EntityThe request was well-formed, however, it couldn't be carried out because of semantic flaws.
429 - Too Many RequestsThe user has issued an excessive number of requests in a short period of time ("rate limiting").
500, 502, 503, 504 - Server ErrorsSomething went wrong on Curacels' end. (These are rare.)

Note that together with this response, a user-friendly page explaining the problem should be sent.

Likely Errors You May Encounter

400 Bad Request

{
    "message": "400 Bad Request (Client Error)"
}

We recommend you debug this by checking the following likely causes:

  • Your request syntax
  • Code logic
  • URL string syntax
  • Query/Path Parameter required

401 Unauthorized

{
    "message": "Unauthenticated."
}
Causes

This error message is usually caused when the security credential required to authenticate your request is not supplied.

Fixes

The possible fixes include:

  • including your API key in the header part of your request.
  • checking if your API key is correct
  • checking if your API key is not invalid or expired.

404 Not Found

{
    "message": "Sorry, the Customer you requested was not found"
}
Causes

Factors may include:

  • the requested resource is not available on the server
  • your request URL is broken or incorrect
  • your supplied parameter value is incorrect
  • network issue (making another request may fix it)
Fixes
  • refresh or make your request again
  • check the endpoint URL syntax to ensure it is correct
  • check if what you are requesting is available on the server
422 Unprocessable Content
{
    "message": "The given data was invalid"
}
{
    "message": "The given data was invalid",
    "errors": {
        "customer_ref": [
            "The selected customer ref is invalid",
            "The selected customer ref is invalid"
        ],
        "product_code": [
            "The product code field is required",
            "The product code field is required"
        ]
    }
}
Causes

This is caused when you supply invalid data on your request despite your request being correct. The server will return a 422 error if it cannot process the data you supplied on your request because it is most likely invalid or incorrect.

Fixes
  • Supply the correct data and data type on your request