1. Go to this page and download the library: Download codejutsu1/laravel-vtung library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$data = [
'phone' => '09137822222', // Phone Number
'network_id' => 'mtn', // Network Provider
'variation_id' => 'mtn-75gb-15000' //variation id of the mobile data to purchase
];
try{
$response = Vtu::buyData($data);
/**
* Alternatively, use:
*
* $response = vtu()->buyData($data);
*/
}catch(\Exception $e){
return redirect()->back()->withMessage($e->getMessage());
}
if($response['code'] == 'success'){
//Your business logic here.
}
$data = [
'customer_id' => '62418234034', // Customer's smartcard number or meter number
'service_id' => 'gotv', // Unique id for all cable Tv and electricity services.
'variation_id' => 'prepaid' // Meter type of the electricity company, optional for cable Tvs.
];
try{
$response = Vtu::verifyCustomer($data);
/**
* Alternatively, use:
*
* $response = vtu()->verifyCustomer($data);
*/
}catch(\Exception $e){
return redirect()->back()->withMessage($e->getMessage());
}
if($response['code'] == 'success'){
//Your business logic here.
}
$data = [
'phone' => '09137822222', //Phone number stored for reference
'smartcard_number' => '62418234034', // Customer's smartcard/IUC number
'service_id' => 'gotv', // Unique id for all cable Tv.
'variation_id' => 'gotv-max' // Variation ID for cable package.
];
try{
$response = Vtu::subscribeTv($data);
/**
* Alternatively, use:
*
* $response = vtu()->subscribeTv($data);
*/
}catch(\Exception $e){
return redirect()->back()->withMessage($e->getMessage());
}
if($response['code'] == 'success'){
//Your business logic here.
}
$data = [
'phone' => '09137822222', //Phone number stored for reference
'meter_number' => '62418234034', // Customer's meter number
'service_id' => 'ikeja-electric', // Unique id for electricity companies.
'variation_id' => 'prepaid', // meter type, either prepaid or postpaid.
'amount' => 8000, //amount of electricity you want to purchase.
];
try{
$response = Vtu::buyElectricity($data);
/**
* Alternatively, use:
*
* $response = vtu()->buyElectricity($data);
*/
}catch(\Exception $e){
return redirect()->back()->withMessage($e->getMessage());
}
if($response['code'] == 'success'){
//Your business logic here.
}
bash
php artisan vtung:install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.