PHP code example of henryejemuta / php-clubkash-vtu

1. Go to this page and download the library: Download henryejemuta/php-clubkash-vtu 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/ */

    

henryejemuta / php-clubkash-vtu example snippets


use HenryEjemuta\Clubkash\Client;

$config = [
    'timeout' => 30,
];

$client = new Client('YOUR_USER_ID', 'YOUR_API_KEY', $config);

try {
    $balance = $client->getWalletBalance();
    print_r($balance);
} catch (\Exception $e) {
    echo "Error: " . $e->getMessage();
}

// Network Codes: 01=MTN, 02=GLO, 03=9Mobile, 04=Airtel
$response = $client->purchaseAirtime('01', 100.00, '08012345678');
print_r($response);

// Data Plan Code: Get from ClubKash Documentation or use verify tool
$response = $client->purchaseData('01', 'DATA_PLAN_CODE', '08012345678');
print_r($response);

// CableTV: 'dstv', 'gotv', 'startimes'
$response = $client->purchaseCableTV('dstv', 'package_code', 'IUC_NUMBER', 'PHONE_NUMBER');
print_r($response);

// ElectricCompany: '01', '02', etc. MeterType: '01' (Prepaid), '02' (Postpaid)
$response = $client->purchaseElectricity('01', 'METER_NUMBER', '01', 1000.00, 'PHONE_NUMBER');
print_r($response);
bash
composer