PHP code example of bnbwebexpertise / laravel-paybox-gateway

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

    

bnbwebexpertise / laravel-paybox-gateway example snippets

   
   composer 

   Bnb\PayboxGateway\Providers\PayboxServiceProvider::class,
   

$authorizationRequest = \App::make(\Bnb\PayboxGateway\Requests\AuthorizationWithCapture::class);

return $authorizationRequest->setAmount(100)->setCustomerEmail('[email protected]')
            ->setPaymentNumber(1)->send('paybox.send');

$payment = Payment::where('number', $request->input('order_number'))->firstOrFail();
$payboxVerify = \App::make(\Bnb\PayboxGateway\Responses\Verify::class);
try {
    $success = $payboxVerify->isSuccess($payment->amount);
    if ($success) {
       // process order here after making sure it was real payment
    }
    echo "OK";
}
catch (InvalidSignature $e) {
    Log::alert('Invalid payment signature detected');
}

$payment = PaymentModel::find($idOfAuthorizedPayment);
$captureRequest = \App::make(\Bnb\PayboxGateway\Requests\Capture::class);
$response = $captureRequest->setAmount($payment->amount)
                           ->setPayboxCallNumber($payment->call_number)
                           ->setPayboxTransactionNumber($payment->transaction_number)
                           ->send();
                           
if ($response->isSuccess()) {
     // process order here                
}
bash
       php artisan vendor:publish --provider="Bnb\PayboxGateway\Providers\PayboxServiceProvider" --tag=migrations
   
bash
       php artisan migrate
   
bash
    php artisan vendor:publish --provider="Bnb\PayboxGateway\Providers\PayboxServiceProvider"