PHP code example of damianjozwiak / laravel-przelewy24

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

    

damianjozwiak / laravel-przelewy24 example snippets

   
   composer 

    php artisan vendor:publish --provider="Damianjozwiak\Transfers24\Providers\Transfers24ServiceProvider"
    
      
$payment = app()->make(\App\Payment::class);
$registration_request = app()->make(\Damianjozwiak\Transfers24\Requests\Transfers24::class);

$register_payment = $registration_request->setEmail('[email protected]')->setAmount(100)->setArticle('Article Name')->init();

if($register_payment->isSuccess())
{
    // save registration parameters in payment object
    
    return $registration_request->execute($register_payment->getToken(), true);
}

$payment_verify = app()->make(\Damianjozwiak\Transfers24\Requests\Transfers24::class);
$payment_response = $payment_verify->receive($request);

if ($payment_response->isSuccess()) {
    $payment = Payment::where('session_id',$payment_response->getSessionId())->firstOrFail();
   // process order here after making sure it was real payment
}
echo "OK";