This documentation provides information on how to use PHP and cURL to make a POST request to the "Retrieve Account Number" API. This API allows you to retrieve an account number by providing a payment reference. The example below demonstrates how to use this API with PHP.
Prerequisites
Before using this API, ensure you have the following:
Request Details
http://localhost/virtual/api/retrieve_account_number. Note that this URL points to a local development environment; ensure it matches your specific setup in a production environment.Content-Type: Set to application/json to specify that the request body contains JSON data.API-Key: Replace with your actual API key provided for authentication purposes.Merchant-Id: Replace with your actual Merchant ID, which identifies your merchant account.Response
The response from the API will be stored in the $response variable in the provided PHP code. You can process and use this response data as needed within your PHP application.
Error Handling
It's essential to implement proper error handling in your code to address potential issues, such as network errors or API responses indicating errors. You can parse the API response to check for error messages or status codes and handle them accordingly.
{
"response_code": 0,
"response_message": "Successful",
"data": {
"id": "233389999002",
"account_name": "IFY HUG",
"account_number": "4011536001",
"bank_name": "Premium Trust Bank"
}
}