Build With MyBundlePay
One integration for payments, cards, bills and payouts.
MyBundlePay gives developers a clean payment gateway, virtual account funding, payout rails, card issuing tools, bill payments, webhooks and merchant-ready checkout experiences.
REST APIs
JSON based
Webhooks
Real time events
Sandbox
Test first
API Test Console
Test the current endpoint directly from the documentation. Secret keys stay inside this browser session.
Enter your test key, review the sample body for this page, then send a request.
API Documentation for Bank Validation Functionality
This documentation provides step-by-step guidance for developers to integrate functionalities for validating bank account V2 using PHP cURL or NodeJs. Each section includes the method, endpoint, request parameters, and sample responses.
GET https://mybundlepay.com/ng/api/v2/validate-bank-account
HEADERS
Authorization* string
Pass your {secret_key} as a bearer token in the request header to authorize this call
Accept application/json
REQUEST PARAMETERS*
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| accountNumber | string | Yes | The account number you want to validate. Must be a valid bank account number with a maximum length of 10. | "1234567890" |
| bankCode | string | Yes | The code identifying the bank where the account is held. This must correspond to a valid bank in the system. | "044" |
Details for Request Parameters:
-
accountNumber:
- This is the account number you want to validate.
- It must be a string, even if it contains only numeric characters.
- Ensure the length does not exceed 10 characters to meet validation requirements.
- Example: "1234567890"
-
bankCode:
- This parameter identifies the bank associated with the provided account number.
- Use the correct code for the bank as defined in the system. You can fetch the list of valid bank codes using the Fetch Banks API.
- Example: "044" (Code for Access Bank in Nigeria).
< ?php
// Initialize cURL
$ch = curl_init();
// Define the API endpoint
$url = "https://mybundlepay.com/ng/api/v2/validate-bank-account";
// Replace {secret_key} with your actual secret key
$secretKey = "{secret_key}";
// Replace with actual account details
$requestBody = [
"accountNumber" => "1234567890",
"bankCode" => "044"
];
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestBody));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $secretKey",
"Content-Type: application/json",
"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 "Account validation successful:\n";
echo "Account Name: " . $responseData['data']['accountName'] . "\n";
echo "Account Number: " . $responseData['data']['accountNumber'] . "\n";
echo "Bank Code: " . $responseData['data']['bankCode'] . "\n";
} else {
// Failed response
$message = $responseData['message'] ?? 'Unknown error occurred.';
echo "Failed to validate account: $message\n";
}
?>
const axios = require('axios');
// Define the API endpoint
const url = "https://mybundlepay.com/ng/api/v2/validate-bank-account";
// Replace {secret_key} with your actual secret key
const secretKey = "{secret_key}";
// Replace with actual account details
const requestBody = {
accountNumber: "1234567890",
bankCode: "044"
};
// Set headers
const headers = {
Authorization: `Bearer ${secretKey}`,
"Content-Type": "application/json",
Accept: "application/json",
};
// Function to validate the bank account
const validateBankAccount = async () => {
try {
const response = await axios.post(url, requestBody, { headers });
const responseData = response.data;
if (responseData.status === "success") {
// Success response
console.log("Account validation successful:");
console.log("Account Name:", responseData.data.accountName);
console.log("Account Number:", responseData.data.accountNumber);
console.log("Bank Code:", responseData.data.bankCode);
} else {
// Failed response
console.log("Failed to validate account:", responseData.message);
}
} catch (error) {
// Handle errors
if (error.response) {
console.error("API Error:", error.response.data.message || "Unknown error occurred.");
} else {
console.error("Request Error:", error.message);
}
}
};
// Call the function
validateBankAccount();
Request Response
{
"accountNumber": "1234567890",
"bankCode": "044"
}
Live Token Success Response
{
"status": "success",
"message": "Approved or completed successfully",
"data": {
"accountNumber": "1234567890",
"accountName": "Ahamad Musa",
"sessionId": "xxxxxxxxxxxxxxxx",
"bankCode": "044"
}
}
Test Token Success Response
{
"status": "success",
"message": "Approved or completed successfully",
"data": {
"accountNumber": "1234567890",
"accountName": "MYBUNDLEPAY TEST",
"bankCode": "044"
}
"mode": "test"
}
Error Response (Invalid Bank Code)
{
"status": "failed",
"message": "Bank code is either incorrect or does not exist."
}