API Documentation for NG Banks Functionality
This documentation provides step-by-step guidance for developers to integrate functionalities for fetching banks V2 using PHP cURL or NodeJs. Each section includes the method, endpoint, request parameters, and sample responses.
GET https://mybundlepay.com/ng/api/fetchBanks
HEADERS
Authorization* string
Pass your {secret_key} as a bearer token in the request header to authorize this call
Accept application/json
< ?php
// Initialize cURL
$ch = curl_init();
// Define the API endpoint
$url = "https://mybundlepay.com/ng/api/fetchBanks";
// Replace {secret_key} with your actual secret key
$secretKey = "{secret_key}";
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $secretKey",
"Accept: application/json",
]);
// Execute the cURL request
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo "cURL Error: " . curl_error($ch);
curl_close($ch);
exit;
}
// Close the cURL session
curl_close($ch);
// Decode and process the response
$responseData = json_decode($response, true);
if (isset($responseData['status']) && $responseData['status'] === 'success') {
// Success response
echo "Banks fetched successfully:\n\n";
foreach ($responseData['data'] as $bank) {
echo "Bank Name: " . $bank['bank_name'] . "\n";
echo "Bank Code: " . $bank['bank_code'] . "\n\n";
}
} else {
// Failed response
$message = $responseData['message'] ?? 'Unknown error occurred.';
echo "Failed to fetch banks: $message\n";
}
?>
const axios = require('axios');
// Define the API endpoint and secret key
const url = "https://mybundlepay.com/ng/api/fetchBanks";
const secretKey = "{secret_key}"; // Replace {secret_key} with your actual secret key
// Configure headers
const headers = {
Authorization: `Bearer ${secretKey}`,
Accept: "application/json",
};
// Function to fetch banks
async function fetchBanks() {
try {
const response = await axios.get(url, { headers });
if (response.data.status === "success") {
console.log("Banks fetched successfully:\n");
// Iterate and display the banks
response.data.data.forEach((bank) => {
console.log(`Bank Name: ${bank.bank_name}`);
console.log(`Bank Code: ${bank.bank_code}\n`);
});
} else {
console.log(`Failed to fetch banks: ${response.data.message}`);
}
} catch (error) {
console.error("Error fetching banks:", error.message || error);
}
}
// Call the function
fetchBanks();
Response
{
"status": "success",
"message": "Banks fetched successfully",
"data": [
{
"bank_code": "110072",
"bank_name": "78 FINANCE COMPANY LIMITED"
},
{
"bank_code": "120001",
"bank_name": "9 PAYMENT SOLUTIONS BANK"
},
}