API Documentation for Payout Functionality
This documentation provides step-by-step guidance for developers to integrate functionalities for payout using PHP cURL or NodeJs. Each section includes the method, endpoint, request parameters, and sample responses.
GET https://mybundlepay.com/ng/api/payout
HEADERS
Authorization* string
Pass your {secret_key} as a bearer token in the request header to authorize this call
Accept application/json
REQUEST PARAMETERS*
The request body parameters include the required amount (integer) representing the withdrawal amount in the smallest currency unit, bank_code (string) for the bank code from the fetch banks endpoint, account_number (string) for the recipient's bank account number, and account_name (string) for the recipient's account name.
Notes for Developers
1. API Key Security: Ensure the API key is stored securely, such as in environment variables.
2. Error Handling: Always implement error handling for failed requests or invalid responses.
3. Rate Limits: Check the API provider’s documentation for rate limits and implement retry mechanisms if needed.
4. Currency Unit: The amounts are typically in the smallest currency unit (e.g., kobo for NGN). Ensure proper conversions.
5. Test vs. Live: Use test API keys for development and testing, and ensure live keys are only used in production.
< ?php
// Data to be sent as query parameters
$data = [
"amount" => 100000, // Amount in kobo (e.g., 100000 = NGN 1000)
"bank_code" => "001",
"account_number" => "1234567890",
"account_name" => "John Doe",
"reason" => "Payment for services" // Custom reason for the transaction
];
// Build the query string from the data array
$queryString = http_build_query($data);
// Set up the cURL session for GET
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://mybundlepay.com/ng/api/payout?" . $queryString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer {secret_key}', // Replace {secret_key} with your actual secret key
'Content-Type: application/json',
]);
// Execute the request
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
const axios = require('axios');
// Data to be sent in the request body
const data = {
amount: 100000, // Amount in kobo (e.g., 100000 = NGN 1000)
bank_code: "001",
account_number: "1234567890",
account_name: "John Doe"
reason: "Payment for service"
};
// API URL
const url = "https://mybundlepay.com/ng/api/payout";
// Secret key for Authorization header
const secretKey = 'YOUR_SECRET_KEY'; // Replace with your actual secret key
// Send POST request using axios
axios.post(url, data, {
headers: {
'Authorization': `Bearer ${secretKey}`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data); // Handle successful response
})
.catch(error => {
console.error('Error:', error); // Handle any errors
});
Successful Request Response
{
"status": "success",
"data": {
"id": "txn_12345",
"amount": 100000,
"status": "COMPLETED",
"bank_name": "First Bank of Nigeria",
"account_number": "1234567890",
"account_name": "John Doe"
}
}
Error Response
{
"status": "failed",
"message": "Insufficient balance."
}