A laravel package to seamlessly integrate HusmoData API into your laravel application. The HusmoData API allows you to integrate all virtual top-up and bills payment services available on the HusmoData platform with your application (websites, desktop apps & mobile apps). You can also start your own VTU business by integrating this API and resell HusmoData services in Nigeria.
henryejemuta/laravel-husmodata is a Laravel package for a laravel package to seamlessly integrate husmodata api into your laravel application. the husmodata api allows you to integrate all virtual top-up and bills payment services available on the husmodata platform with your application (websites, desktop apps & mobile apps). you can also start your own vtu business by integrating this api and resell husmodata services in nigeria..
It currently has 0 GitHub stars and 31 downloads on Packagist.
Install it with composer require henryejemuta/laravel-husmodata.
Discover more Laravel packages by henryejemuta
or browse all Laravel packages to compare alternatives.
Last updated
The HusmoData API allows you to integrate all virtual top-up and bills payment services available on the HusmoData platform with your application (websites, desktop apps & mobile apps). You can also start your own VTU business by integrating this API and resell HusmoData services in Nigeria.
Laravel HusmoData is a laravel package to seamlessly integrate HusmoData api within your laravel application.
Create a HusmoData Account Sign Up.
Get your API Token from your HusmoData Dashboard Get My API Token.
Look up HusmoData API Documentation API Documentation.
You can install the package via composer:
composer require henryejemuta/laravel-husmodata
Publish HusmoData configuration file, migrations as well as set default details in .env file:
php artisan husmodata:init
Important: Kindly use the $response->successful() to check the response state before proceeding with working with the response and gracefully throw and handle the HusmoDataErrorException on failed request
Before initiating any transaction kindly check your balance to confirm you have enough HusmoData balance to handle the transaction
The Laravel HusmoData Package is quite easy to use via the HusmoData facade
use HenryEjemuta\LaravelHusmoData\Facades\HusmoData;
use HenryEjemuta\LaravelHusmoData\Classes\HusmoDataResponse;
...
//To buy Airtime
try{
$response = HusmoDataFacade::buyAirtime(NetworkEnum::getNetwork('mtn'), 100, '08134567890');
} catch (HusmoDataErrorException $exception) {
Log::error($exception->getMessage() . "\n\r" . $exception->getCode());
}
//A dump of the HusmoDataResponse on successful airtime purchase
/*
HenryEjemuta\LaravelHusmoData\Classes\HusmoDataResponse {#1423 ▼
-message: ""
-hasError: false
-error: null
-code: 200
-body: {#1539 ▼
+"id": 167630
+"airtime_type": "VTU"
+"network": 1
+"paid_amount": "97.0"
+"mobile_number": "08134567890"
+"amount": "100"
+"plan_amount": "₦100"
+"plan_network": "MTN"
+"balance_before": "2892.6"
+"balance_after": "2795.6"
+"Status": "successful"
+"create_date": "2021-08-28T21:02:54.311846"
+"Ported_number": true
}
}
*/
//To buy Data Bundle
try{
$response = HusmoDataFacade::buyData(HusmoDataNetworkEnum::getNetwork("mtn"), 7, "08134567890");
} catch (HusmoDataErrorException $exception) {
Log::error($exception->getMessage() . "\n\r" . $exception->getCode());
}
//A dump of the HusmoDataResponse on successful data purchase
/*
HenryEjemuta\LaravelHusmoData\Classes\HusmoDataResponse {#1423 ▼
-message: ""
-hasError: false
-error: null
-code: 200
-body: {#1539 ▼
+"id": 108602
+"network": 1
+"balance_before": "2698.6"
+"balance_after": "2459.6"
+"mobile_number": "08134567890"
+"plan": 7
+"Status": "successful"
+"plan_network": "MTN"
+"plan_name": "1.0GB"
+"plan_amount": "₦239.0"
+"create_date": "2021-08-28T21:27:41.169631"
+"Ported_number": true
}
}
...
*/
Find an overview of all method with comment on what they do and expected arguments
/**
* Get Your MegaSub account details including available balance
* @return HusmoDataResponse
* @throws HusmoDataErrorException
*/
public function checkUserDetails(): HusmoDataResponse
/**
* @param NetworkEnum $mobileNetwork
* @param int $amount
* @param $phoneNumber
* @param bool $portedNumber
* @param string $airtimeType
* @return HusmoDataResponse
* @throws HusmoDataErrorException
*/
public function buyAirtime(NetworkEnum $mobileNetwork, int $amount, $phoneNumber, bool $portedNumber = true, string $airtimeType = "VTU"): HusmoDataResponse
/**
* HusmoData API Transaction handler to access:
* Transaction()->getAllDataTransaction(): HusmoDataResponse
* Transaction()->queryDataTransaction(int $txnId): HusmoDataResponse
* Transaction()->queryAirtimeTransaction(int $txnId): HusmoDataResponse
* Transaction()->queryElectricityBillTransaction(int $txnId): HusmoDataResponse
* Transaction()->queryCableTvTransaction(int $txnId): HusmoDataResponse
*
* @return Transaction
*/
public function Transaction(): Transaction
/**
* Cable TV Bill handler to access:
* CableTv()->verifyIUC(CableTvEnum $cableTv, $smartCardNo): HusmoDataResponse
* CableTv()->purchasePackage(CableTvEnum $cableTv, string $package, $smartCardNo): HusmoDataResponse
*
* @return CableTv
*/
public function CableTv(): CableTv
/**
* @param NetworkEnum $network
* @param string $plan
* @param string $phoneNumber
* @param bool $portedNumber
* @return HusmoDataResponse
* @throws HusmoDataErrorException
*/
public function buyData(NetworkEnum $network, string $plan, string $phoneNumber, bool $portedNumber = true): HusmoDataResponse
/**
* Electricity Bills payment handler to access:
* Electricity()->verifyMeterNumber(DiscoEnum $disco, $meterNumber, MeterTypeEnum $meterType): HusmoDataResponse
* Electricity()->buyElectricity(DiscoEnum $disco, $meterNumber, $amount, MeterTypeEnum $meterType): HusmoDataResponse
*
* @return Electricity
*/
public function Electricity(): Electricity
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.