Error Handling

When developing on Paga API you will notice three major types of errors

  • Authorisation Error
  • Bad Request
  • System Error

Except for the Authorisation error, all other errors will return a responCode and errorMessage, the responseCode will include a number that is not zero and the errorMessage will return a human-readable error message.

Authentication Error

Authentication error will be returned where either the public key or secret key is incorrect. When this type of error occurs, check that you’re using the right API keys, if you’re not sure, generate a new secret key and try again.

Another likely scenario for authorisation error is mismatching the base URL for the live and test environment. Check that you’re using the correct base URL for your API call.

Authorisation error will always return the status as 401 Unauthorised

{
	"error" : "Invalid paga account id or password"
}

Validation Error

Validation Error is returned when one or more information parsed in the API is incorrect, specifically any validation rules expected to be parsed correctly before honouring the request initiated. The most prevalent validation error will involve the hash parameter in the header on any request. Where an incorrect hash is parsed into the request header, the request will fail with a validation error.

If you experience a similar error, see Hashing for reference.

Validation error will always return the status as 400 Bad Request.

{
    "errorMessage": "Server Error",
    "responseCode": ""
}

Server Error

Server error is returned when something goes wrong on our end, this may happen if a service on our end is not able to process your request.

In cases like this, you’re advised to try again after a while or reach out to the business support team.

Server error will always return the status as 500 Bad Request

{
    "errorMessage": "Server Error",
    "responseCode": ""
}

Paga Specific Error

Paga specific errors are usually returned when a specific request is parsed (like authorisation) but the system failed to honour it due to some restriction, it could be a regulatory compliance check, resource limit or user-specific restrictions.

Paga APIs are generally arranged as a collection, depending on the services in use, the error codes are mapped and specific to its own collection.

For any endpoint within each of the Paga collections below, see their respective error code docs


What’s Next