PHP code example of microweber-dev / omnipay-przelewy24

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

    

microweber-dev / omnipay-przelewy24 example snippets




use Omnipay\Omnipay;

/** @var \Omnipay\Przelewy24\Gateway $gateway */
$gateway = Omnipay::create('Przelewy24');

$gateway->initialize([
    'merchantId' => 'YOUR MERCHANT ID HERE',
    'posId'      => 'YOUR POS ID HERE',
    'crc'        => 'YOUR CRC KEY HERE',
    'testMode'   => true,
]);

$params = array(
    'sessionId' => 2327398739,
    'amount' => 12.34,
    'currency' => 'PLN',
    'description' => 'Payment test',
    'returnUrl' => 'www.your-domain.nl/return_here',
    'notifyUrl' => 'www.your-domain.nl/notify_here',
    'card' => array(
        'email' => '[email protected]',
        'name' => 'My name',
        'country' => 'NL',
    ),
);

$response = $gateway->purchase($params)->send();

if ($response->isSuccessful()) {
    $response->redirect();
} else {
    echo 'Failed';
}