Handling Errors

API Errors

All errors returned by the PaymentExpress API share a standard format. In addition to a relevant HTTP error code, all errors return a JSON object which contains 2-3 keys/values, formatted like below:

{
  "errorCode": "NO_REMAINING_BALANCE_TO_VOID",
  "errorMessage": "There is no remaining balance for payment 'J3050040352'",
  "displayMessage": "There was an error voiding payment 'J3050040352'."
}

Of these three fields, two fields will always be present on an error response, and a third will be present only if there is a useful message to be displayed to the user attempting to perform the operation. The three fields are as below:

  • errorCode - A short form error code indicating most concisely the class of error that has occurred.
  • errorMessage - A more descriptive message to the developer integrating against the API as to why the problem occurred. This message is not to be shared with the customer as a result of the operation.
  • displayMessage (Optional) - A more descriptive and user-friendly message which can be displayed to a customer as a result of the failure to perform the requested operation. In the absence of this sort of message, please display only a generic problem error message.

Workflow Error Handling

Each different payment workflow and integration type has an error handling workflow that takes into account both the integration type as well as the type(s) of reconciliation that have been opted for in the integration. To see the error handling workflows, please check in the appropriate documentation section on the left, and/or reach out to our Payments team for more details.