PHP code example of myckhel / laravel-vtpass

1. Go to this page and download the library: Download myckhel/laravel-vtpass 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/ */

    

myckhel / laravel-vtpass example snippets




return [
  "username"          => env("VTPASS_USERNAME"),
  "password"          => env("VTPASS_PASSWORD"),
  // specify to use sandbox mode or live mode
   "mode"              => env("VTPASS_MODE", "sandbox"), // app mode sandbox ?? live
];

use Vtpass;

Vtpass::verify($parameters);
Vtpass::purchase($parameters);
Vtpass::status($parameters);
Vtpass::variations($parameters);

Myckhel\Vtpass\Support\MobileAirtime;
Myckhel\Vtpass\Support\MobileData;
Myckhel\Vtpass\Support\Electric;
Myckhel\Vtpass\Support\TvSub;
Myckhel\Vtpass\Support\Education;

use Myckhel\Vtpass\Support\MobileAirtime;

public function buyAirtime(){ 
  $serviceID = 'mtn'
  $phone = '111111111'
  $amount = 100

  return MobileAirtime::purchase([
    'serviceID'   => $serviceID,
    'phone'       => $phone,
    'amount'      => $amount,
  ]);
}

MobileAirtime::status([
  'request_id' => '24545544'
]);

use Myckhel\Vtpass\Support\Electric;

$serviceID = 'ikeja-electric'
$meter = '111111111'
$type = 'prepaid'

Electric::verify([
  'serviceID'   => $serviceID,
  'billersCode' => $meter,
  'type'        => $type,
]);
bash
php artisan vendor:publish --provider="Myckhel\Vtpass\VtpassServiceProvider"
vtpass.php
json
{  
   "code":"000",
   "response_description":"TRANSACTION SUCCESSFUL",
   "requestId":"SAND0192837465738253A1HSD",
   "transactionId":"1563873435424",
   "amount":"50.00",
   "transaction_date":{  
      "date":"2019-07-23 10:17:16.000000",
      "timezone_type":3,
      "timezone":"Africa/Lagos"
   },
   "purchased_code":""
}