PHP code example of lukasz-adamski / laravel-przelewy24

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

    

lukasz-adamski / laravel-przelewy24 example snippets


Adams\Przelewy24\Przelewy24ServiceProvider::class,

'Przelewy24' => Adams\Przelewy24\Facades\Facade::class,

php artisan vendor:publish --provider="Adams\Przelewy24\Przelewy24ServiceProvider"

/**
 * The URIs that should be excluded from CSRF verification.
 *
 * @var array
 */
protected $except = [
    '/webhook/przelewy24'
];



namespace App\Http\Controllers;

use Przelewy24;
use Adams\Przelewy24\Transaction;
use App\Http\Controllers\Controller;
use Illuminate\Support\Str;

class ExampleController extends Controller
{
    /**
     * Redirect user to payment provider.
     *
     * @return Response
     */
    public function pay()
    {
        $payload = new Transaction();
        $payload->setSessionId(Str::random(30));
        $payload->setAmount($item->price * 100);
        $payload->setDescription('My item description');
        $payload->setEmail('[email protected]');
        $payload->setUrlReturn(url('/'));

        return Przelewy24::redirect($payload);
    }
}



namespace App\Listeners;

use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Adams\Przelewy24\Events\TransactionVerified;

class ReceivePayment
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param TransactionVerified $event
     * @return void
     */
    public function handle(TransactionVerified $event)
    {
        //
    }
}

/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    \Adams\Przelewy24\Events\TransactionVerified::class => [
        \App\Listeners\ReceivePayment::class,
    ],
];
bash
php vendor/bin/phpunit