PHP code example of ovac / laravel-hubtel-payment

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

    

ovac / laravel-hubtel-payment example snippets


OVAC\LaravelHubtelPayment\ServiceProvider::class,

'HubtelPayment' => OVAC\LaravelHubtelPayment\Facades\LaravelHubtelPayment::class,



use OVAC\LaravelHubtelPayment\Facades\HubtelPayment;

// NOTE: The phone number must be of type string as Laravel considers all numbers with a leading 0 to be a hex number.
$payment = HubtelPayment::SendMoney()
                ->to('0553577261')                  //- The phone number to send the prompt to.
                ->amount(100.00)                    //- The exact amount value of the transaction
                ->description('Online Purchase')    //- Description of the transaction.
                ->customerEmail('[email protected]') //- Name of the person making the payment.
                ->channel('mtn-gh')                 //- The mobile network Channel.
                ->run();                            //- Run the transaction after 



use OVAC\LaravelHubtelPayment\Facades\HubtelPayment;

$payment = HubtelPayment::Refund()
                ->transactionId(1234)               //- The ID of the transaction to refund.
                ->amount(100.00)                    //- The exact amount value of the transaction
                ->clientReference('#11212')         //- A refeerence on your end.
                ->description('Useless Purchase')   //- Description of the transaction.
                ->reason('No longer needs a pen')   //- Name of the person making the payment.
                ->full()                            //- Full or partial refund.
                ->run();                            //- Run the transaction after 
sh
php artisan vendor:publish --provider="OVAC\LaravelHubtelPayment\ServiceProvider" --tag="config"