PHP code example of gitkv / laravel-uniteller

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

    

gitkv / laravel-uniteller example snippets


'providers' => [
    gitkv\Uniteller\LaravelServiceProvider::class
],
'aliases' => [
    'Uniteller' => gitkv\Uniteller\Facade\Uniteller::class,
],

$app->register(gitkv\Uniteller\LumenServiceProvider::class);


use gitkv\Uniteller\Facade\Uniteller;
use Tmconsulting\Uniteller\Payment\PaymentBuilder;

$builder = (new PaymentBuilder())
    ->setOrderIdp('invoice_number')
    ->setSubtotalP(10)
    ->setCustomerIdp('customer_id');

$redirectUrl = Uniteller::pay($builder);

Uniteller::pay($builder, false);


use gitkv\Uniteller\Facade\Uniteller;
use Tmconsulting\Uniteller\Recurrent\RecurrentBuilder;

$builder = (new RecurrentBuilder())
    ->setOrderIdp(mt_rand(10000, 99999))
    ->setSubtotalP(15)
    ->setParentOrderIdp(00000) // order id of any past payment
    ->setParentShopIdp($uniteller->getShopId()); // optional

$result = Uniteller::recurrentPay($builder);


use gitkv\Uniteller\Facade\Uniteller;

$result = Uniteller::receiveResult($orderIdp);


use gitkv\Uniteller\Facade\Uniteller;
use Tmconsulting\Uniteller\Cancel\CancelBuilder;

$builder = (new CancelBuilder())->setBillNumber('RRN Number, (12 digits)');
$result = Uniteller::cancel($builder);


use gitkv\Uniteller\Facade\Uniteller;

if (! Uniteller::verifyCallbackRequest(['all_parameters_from_post_with_signature'])) {
    return 'invalid_signature';
}


namespace App\Listeners;


use gitkv\Uniteller\Events\UnitellerCallbackEvent;

class UnitellerCallbackListener {

    public function __construct() {
        //
    }

    public function handle(UnitellerCallbackEvent $event) {
        $payload = $event->getPayload();
        
        //your code here...
    }
}
bash
php artisan vendor:publish --provider="gitkv\Uniteller\LaravelServiceProvider" --tag=config
bash
cp vendor/gitkv/laravel-uniteller/config/uniteller.php config/app.php