KudaApiToken is a library to allow communication with Kuda Bank API to setup your own fintech apps
giftbalogun/kudaapitoken is a Laravel package for kudaapitoken is a library to allow communication with kuda bank api to setup your own fintech apps.
It currently has 1 GitHub stars and 50 downloads on Packagist (latest version 1.1.6).
Install it with composer require giftbalogun/kudaapitoken.
Discover more Laravel packages by giftbalogun
or browse all Laravel packages to compare alternatives.
Last updated
Enable your product for local transactions with the KUDA Open API platform! With the KUDA Open APIs, you can embed services on your platform and connect your customers to a wide range of banking services.
Note: Ensure you have a KUDA Business account linked to your profile for live access.
PHP 7.2+ and Composer are required.
To get the latest version of KudaApiToken, simply require it
composer require giftbalogun/kudapaitoken
Or add the following line to the require block of your composer.json file.
"giftbalogun/kudapaitoken": "1.0.*"
and add This
"repositories": [
{
"type": "git",
"url": "https://github.com/giftbalogun/kudaApiToken"
}
],
You'll then need to run composer install or composer update --prefer-dist to download it and have the autoloader updated.
Publish the configuration file:
php artisan vendor:publish --provider="Giftbalogun\Kudaapitoken\KudaApiTokenServiceProvider"
Open your .env file and add your public key, secret key, merchant email and payment url like so:
KUDA_API_TOKEN=XXXXXXXXXXXXXXXXXXXX
KUDA_API_URL=XXXXXXXXXXXXXXXXXXXXXX
KUDA_USER_EMAIL=YOUR_EMAIL
ENVIRONMENT_ENV=LIVE_OR_TEST
Documentation http://kudaapitoken.readthedocs.io (COMING SOON)
Article Medium to Read https://medium.com/@giftbalogun/laravel-integration-with-kudaopenapi-663825ecd247
Availbale coomand to be use are in COMMAND file with easy to understand related to ServiceTypes.
Send request with this command.
//simple
$data = [
'email' => $request->email,
'phoneNumber' => $request->phone,
'lastName' => $request->l_name,
'firstName' => $request->f_name,
'businessName' => $request->business_name,
'trackingReference' => $customer_code,
]; # $data is the format for making request to the api
$ref = rand(); #used to generate randon unique number for the request
//For Pay with Transfer
$data = [
"Amount"=>5000000,
"IsFlexiblePayment"=>true, //true or false
"RemittingAccounts"=>[
{
"SplitPercentage"=>50,
"AccountName"=>"foods",
"AccountNumber"=>"3020806687"
},
{
"SplitPercentage"=>50,
"AccountName"=>"foods",
"AccountNumber"=>"3020808612"
}
]
];
Styles of Calling the Controller
use Giftbalogun\Kudaapitoken\Controllers\KudaBankController;
$this->kudabankservice->create_virtual_account($data, $ref);
OR
use Giftbalogun\Kudaapitoken\Kuda;
$this->kuda->initController('default')->create_virtual_account($data, $ref);
## Controllers include 'Bill', 'Card', 'GiftCard', 'KudaBank' | Default is same as KudaBank
$kuda->initController('Bill');
$kuda->initController('Card');
$kuda->initController('Saving');
$kuda->initController('PayWith');
$kuda->initController('KudaBank'); // default
$kuda->initController('GiftCard');
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Giftbalogun\Kudaapitoken\Controllers\KudaBankController;
use Giftbalogun\Kudaapitoken\Kuda;
class CustomController extends Controller
{
private $kuda;
private $kudabankservice;
public function __construct()
{
$this->kudabankservice = new KudaBankController();
## Or call from Kuda service
$this->kuda = new Kuda;
}
public function createcustomeraccount()
{
$customer_code = '000' . random_int(100000, 999999) . '0000';
$data = [
'email' => $request->email,
'phoneNumber' => $request->phone,
'lastName' => $request->l_name,
'firstName' => $request->f_name,
'businessName' => $request->business_name,
'trackingReference' => $customer_code,
];
$ref = rand();
$newcustomeraccount = $this->kudabankservice->create_virtual_account($data, $ref);
## Or you can load from the Kuda Service
$newcustomeraccount = $this->kuda->initController('default')->create_virtual_account($data, $ref);
## Controllers include 'Bill', 'Card', 'GiftCard', 'KudaBank' | Default is same as KudaBank
$getvaccount = json_decode($newcustomeraccount['data']);
return $getvaccount;
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Giftbalogun\Kudaapitoken\KudaStatusCodes;
class CustomController extends Controller
{
public function createcustomeraccount()
{
$code = '00';
$message = KudaStatusCodes::getMessage($code, 'kuda_to_kuda');
echo $message ?? 'Unknown Status'; // Output: Successful
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Giftbalogun\Kudaapitoken\Kuda;
class CustomController extends Controller
{
private $kuda;
private $kudabankservice;
public function __construct()
{
##Kuda service
$this->kuda = new Kuda;
}
public function getadminbalance()
{
$data = [];
$ref = rand();
##load from the Kuda Service
$balance = $this->kuda->initController('KudaBank')->getadminbalance($data, $ref);
## Controllers include 'Bill', 'Card', 'GiftCard', 'KudaBank' | Default is same as KudaBank
$getadminbalance = json_decode($balance['data']);
return $getadminbalance;
}
}
This project is under license from MIT. For more details, see the LICENSE file.
Follow me on social media Medium! Twitter! Instagram! LinkedIn! Porfolio!
Made with :heart: by Gift Balogun