Errors

If you're dealing with our API, you'll likely run into five kinds of errors: authorization errors, validation errors, server errors, Notch Pay errors, and provider errors. But no worries, each type of error is attached to a proper HTTP status code.

Fundamentally, all errors follow a common response format. This includes a status key designated as 'error', along with an accompanying error description message. Furthermore, a data or errors object may be present to contain additional details, as applicable.

Authentication errors

When attempting to authorize an API call, failure to provide the public key or incorrect provision of the key will result in authorization errors being generated.

401 - Unauthorized

When faced with this error, it indicates that the request header is missing your public key or that the provided public key is incorrect.

406 - Not Acceptable

This error indicates that the Grant-Authorization header requires your private key to be passed.

403 - Forbidden

The user does not have sufficient privileges to carry out the requested action. Please ensure that the user has the required level of permissions or consult with the system administrator to obtain the necessary authorization to perform the requested action.

Validation errors

Okay, so if your request doesn't follow all the validation rules, you might get some errors. These errors usually mean you're missing some important info that's needed. You'll know it's a validation error cause you'll get hit with a 422 Unprocessable Entities code. Sorry, bud.

Data error - 422 Unprocessable Content

The content provided in the request cannot be processed due to errors or invalid format. It is recommended to double-check the request content and ensure that it complies with the specified input requirements before resubmitting the request.

Example

{
  "code": "422",
  "status": "Unprocessable Content",
  "message": "The email field is required when phone is not present. (and 2 more errors)",
  "errors": {
    "email": [
      "The email field is required when phone is not present."
    ],
    "phone": [
      "The phone field is required when email is not present."
    ],
    "customer_id": [
      "The customer id field is required."
    ]
  }
}

Not Found - 404

The requested resource could not be found on the server. Please ensure that the correct path and parameters have been specified, and that the resource still exists on the server. If the problem persists, please contact the server administrator for further assistance.

Conflict - 409

The reference specified already exists within the system and cannot be added again. Please ensure that unique references are used for each addition and that the system has not already stored the data before attempting to add it again.

Server errors

In the event of server errors, which occur as a result of issues on our end, we recommend that you attempt to retry your request after a brief interval or consider reaching out to our support team for assistance. It should be noted that these errors can be identified by a 500 Internal Server Error code.