PHP code example of maximeb / laravel-8-paybox-gateway

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

    

maximeb / laravel-8-paybox-gateway example snippets

   
   composer 

   Devpark\PayboxGateway\Providers\PayboxServiceProvider::class,
   

    php artisan vendor:publish --provider="Devpark\PayboxGateway\Providers\PayboxServiceProvider"
    

$authorizationRequest = \App::make(\Devpark\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(\Devpark\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(\Devpark\PayboxGateway\Requests\Capture::class);
$response = $captureRequest->setAmount($payment->amount)
                           ->setPayboxCallNumber($payment->call_number)
                           ->setPayboxTransactionNumber($payment->transaction_number)
                           ->setDayRequestNumber(2)
                           ->send();
                           
if ($response->isSuccess()) {
     // process order here                
}