POST https://mybundlepay.com/ng/api/create-dynamic-payment
Generate a temporary Rubies virtual account for accepting a one-time payment. Once the payment is received, MyBundlePay automatically credits your wallet (after applicable charges) and sends a webhook notification to your configured webhook URL.
HEADERS
Authorization
Bearer {secret_key}
Content-Type
application/json
BODY PARAMETERS
| Field | Type | Description |
|---|---|---|
| amount | Number | Amount customer must pay. |
| ref | String | Unique payment reference generated by your system. |
| validTime | Integer |
Validity period in minutes.
Example: 120 = 2 Hours |
| Prefix | Boolean |
Determines the account name displayed on the virtual account.
true = Uses MYBUNDLEPAY CHECKOUT false = Uses the merchant's Business Name + CHECKOUT. If omitted, the default is true. |
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://mybundlepay.com/ng/api/create-dynamic-payment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>'{
"amount":100,
"ref":"MBP-0012-001",
"validTime":120,
"prefix":true
}',
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: Bearer {secret_key}"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
const axios = require("axios");
axios.post("https://mybundlepay.com/ng/api/create-dynamic-payment",{
amount:100,
ref:"MBP-0012-001",
validTime:120
prefix:true
},
{
headers:{
Authorization:"Bearer {secret_key}",
"Content-Type":"application/json"
}
})
.then(res=>{
console.log(res.data);
})
.catch(err=>{
console.log(err.response.data);
});
SUCCESS RESPONSE
{
"status":"success",
"message":"Dynamic Account Generated",
"data":{
"reference":"MBP-0012-001",
"amount":"100.00",
"accountNumber":"8880002187",
"accountName":"MYBUNDLEPAY CHECKOUT",
"bank":"Rubies MFB",
"expiresIn":120
}
}
ERROR RESPONSES
// Duplicate Reference
{
"status":"failed",
"message":"Reference already exists."
}
// Invalid Secret Key
{
"status":"failed",
"message":"Invalid secret key."
}
// Insufficient Balance
{
"status":"failed",
"message":"Insufficient wallet balance."
}
// Validation Error
{
"status":"failed",
"message":"The given data was invalid."
}
// IP Not Whitelisted
{
"status":"failed",
"code":"IP_NOT_WHITELISTED",
"message":"Your IP address is not authorized."
}
// API Failure
{
"status":"failed",
"message":"Unable to create temporary virtual account."
}