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.
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 Wallet Balance Functionality
Overview
This API retrieves a user’s balance based on an authentication token (Bearer token). The token determines if the request is made in a test or live environment.GET https://mybundlepay.com/ng/api/get-balance
HEADERS
Authorization* string
Pass your {secret_key} as a bearer token in the request header to authorize this call
Accept application/json
REQUEST PARAMETERS*
Ensure you have your token ready, either test (sec-test-XXXX) or live (sec-live-XXXX).
Notes for Developers
1. Secure the Token: Store your API tokens securely, avoiding exposure in client-side code.
2. Test Environment: Use test tokens (sec-test-XXXX) during development and live tokens (sec-live-XXXX) for production.
3. Handle Errors: Ensure your application can gracefully handle all possible error responses.
< ?php
// Define the token (replace with your actual token)
$token = '{secret_key}';
// Initialize cURL
$ch = curl_init();
// Set the endpoint URL
$url = 'https://mybundlepay.com/ng/api/get-balance';
// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);
// Add headers
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $token,
'Content-Type: application/json',
]);
// Execute the request
$response = curl_exec($ch);
// Check for errors
if (curl_errno($ch)) {
echo 'cURL Error: ' . curl_error($ch);
curl_close($ch);
exit;
}
// Get HTTP status code
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// Close cURL
curl_close($ch);
// Parse the response
$responseData = json_decode($response, true);
// Handle response based on HTTP status code
if ($httpCode === 200) {
echo "User ID: " . $responseData['user_id'] . "\n";
echo "Balance: " . $responseData['balance'] . "\n";
} else {
echo "Error: " . $responseData['message'] . "\n";
echo "Status: " . $responseData['status'] . "\n";
}
?>
const axios = require('axios');
// Define the token (replace with your actual token)
const token = '{secret_key}';
// Define the API URL
const apiUrl = 'https://mybundlepay.com/ng/api/get-balance'; // Replace with your API endpoint
// Make the GET request using Axios
axios.get(apiUrl, {
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
}
})
.then(response => {
// If successful, log the user ID and balance
console.log("User ID:", response.data.user_id);
console.log("Balance:", response.data.balance);
})
.catch(error => {
// Handle errors if they occur
if (error.response) {
// The request was made, but the server responded with an error
console.log("Error:", error.response.data.message);
console.log("Status:", error.response.data.status);
} else {
// If the error occurred before the request was made
console.log("Error:", error.message);
}
});
Successful Request Response
{
"user_id": "12345",
"balance": "5000.00"
}
Error Response
{
"message": "Invalid token",
"status": "failed"
}
{
"message": "User not found",
"status": "failed"
}
{
"message": "Business not found",
"status": "failed"
}
{
"message": "KYC not approved",
"status": "failed"
}
{
"message": "Balance not found",
"status": "failed"
}
{
"message": "Unrecognized token type",
"status": "failed"
}