Skip to Content

Error Codes

Welcome to Nextra! This is a basic docs template. you can use it as a starting point for your own docs site.

This page lists all possible error responses from the AdmasPay API. Use the error code to identify and handle specific errors in your integration.

HTTP Status Code Reference

400Bad Request
401Unauthorized
404Not Found
500Server Error

Initiate Transaction & Accept Payment

Errors that may occur when initiating a payment transaction

StatusCodeMessageDescription
401--Authorization header is missing or invalid
400invalid-api-keyInvalid api keyThe provided API key is invalid or expired
400missing-mandatory-valueThe field "field_name" is mandatory and wasn't setA required field is missing from the request body
400currency-not-foundFailed to find currencyThe specified currency code is not supported
415--Unsupported Media Type - ensure Content-Type is application/json
400transaction-reference-existsTransaction reference already existsThe txn_ref has already been used. Use a unique reference for each transaction

Verify Payment

Errors when verifying a transaction status

StatusCodeMessageDescription
401--Authorization header is missing or invalid
400invalid-api-keyInvalid api keyThe provided API key is invalid or expired
404transaction-not-foundTransaction not foundNo transaction found with the given reference
400transaction-pendingTransaction is pendingThe transaction has not been completed by the customer yet

Direct Payment

Errors specific to direct payment integration

StatusCodeMessageDescription
401--Authorization header is missing or invalid
400invalid-api-keyInvalid api keyThe provided API key is invalid or expired
400missing-mandatory-valueThe field "field_name" is mandatory and wasn't setA required field is missing from the request body
400currency-not-foundFailed to find currencyThe specified currency code is not supported
415--Unsupported Media Type - ensure Content-Type is application/json
400customer-account-number-too-longAccount number too longThe phone number or account number exceeds the maximum length
400payment-method-not-foundFailed to find the payment methodThe payment_method_code is invalid or not supported

Bank Transfer

Errors when initiating bank transfers

StatusCodeMessageDescription
401--Authorization header is missing or invalid
400invalid-api-keyInvalid api keyThe provided API key is invalid or expired
400payment-method-not-foundFailed to find payment methodThe specified bank code is not supported
400insufficient-balanceInsufficient balanceYour merchant account balance is insufficient for this transfer

List Transactions

Errors when fetching transaction history

StatusCodeMessageDescription
401--Authorization header is missing or invalid
400invalid-api-keyInvalid api keyThe provided API key is invalid or expired

Payment Methods

Errors when fetching available payment methods

StatusCodeMessageDescription
401--Authorization header is missing or invalid
400invalid-api-keyInvalid api keyThe provided API key is invalid or expired

Best Practices for Error Handling

1.

Always check the HTTP status code - Use it to determine the general category of the error before parsing the response body.

2.

Use the error code for specific handling - The code field provides a machine-readable identifier for programmatic error handling.

3.

Display user-friendly messages - Use the message field to show appropriate feedback to your users.

4.

Log errors for debugging - Store the full error response including timestamp for troubleshooting and support requests.

Example Error Response

{
  "status": "error",
  "code": "invalid-api-key",
  "message": "Invalid api key",
  "data": null
}
Last updated on