PHP code example of course-link / omnipay-polish-payments

1. Go to this page and download the library: Download course-link/omnipay-polish-payments 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/ */

    

course-link / omnipay-polish-payments example snippets




use Omnipay\Omnipay;
use CourseLink\Omnipay\Customer;

// Select gateway
$gateway = Omnipay::create('imoje');
$gateway = Omnipay::create('Paynow');
$gateway = Omnipay::create('PayU');
$gateway = Omnipay::create('Przelewy24');
$gateway = Omnipay::create('Tpay');
$gateway->initialize([]); // Pass gateway specific options

// Send purchase request
$response = $gateway->purchase([
    // Minimum options to use with any of package gateways
    'customer' => new Customer([
        'name' => 'John Doe',
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => '[email protected]',
        'address' => 'Testowa 25',
        'city' => 'Warszawa',
        'postcode' => '00-000',
        'country' => 'PL'
    ]),
    'language' => 'pl',
    'amount' => 99.99,
    'description' => 'Ebook',
    'client_ip' => '127.0.0.1',
    'currency' => 'pln',
    'transaction_id' => '1',
    'notifyUrl' => 'https://example.com/notify-url',
    'paymentMethod' => 150 // 



use Omnipay\Omnipay;

// Select gateway
$gateway = Omnipay::create('imoje');
$gateway = Omnipay::create('Paynow');
$gateway = Omnipay::create('PayU');
$gateway = Omnipay::create('Przelewy24');
$gateway = Omnipay::create('Tpay');
$gateway->initialize([]); // Pass gateway specific options

$notification = $gateway->acceptNotification();

$status = $notification->getTransactionStatus();
$data = $notification->getData();
$transactionReference = $notification->getTransactionReference();

if ($gateway->supportsCompletePurchase()) {
    // This is 

use Omnipay\Omnipay;

$gateway = Omnipay::create('imoje');
$gateway->initialize([
    'merchant_id' => '',
    'service_id' => '',
    'service_key' => '',
    'auth_token' => '',
    'test_mode' => false,
    'verify_ip_address' => true,
    'notification_ip_addresses' => [
    ],
]);

$response = $gateway->purchase([
    'customer' => new Customer([
        'firstName' => 'John', //]),
    'language' => 'pl', // //://example.com/cancel-url',
])->send();

$notification = $gateway->acceptNotification(
    options: [], // request body, if empty values are taken from httpRequest
    headers: [] // if empty values are taken from httpRequest
);

$status = $notification->getTransactionStatus();
$data = $notification->getData();
$transactionReference = $notification->getTransactionReference();

use Omnipay\Omnipay;

$gateway = Omnipay::create('Paynow');
$gateway->initialize([
   'api_key' => '',
   'signature_key' => '',
   'test_mode' => true,
]);

$response = $gateway->purchase([
    'customer' => new Customer([
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => '[email protected]', //  'transaction_id' => '1', //

$notification = $gateway->acceptNotification(
    options: [], // request body, if empty values are taken from httpRequest
    headers: [] // if empty values are taken from httpRequest
);

$status = $notification->getTransactionStatus();
$data = $notification->getData();
$transactionReference = $notification->getTransactionReference();

'allow_redirects' => false,

use Omnipay\Omnipay;

$gateway = Omnipay::create('PayU');
$gateway->initialize([
   'pos_id' => '',
   'signature_key' => '',
   'client_id' => '',
   'client_secret' => '',
   'test_mode' => true,
   'verify_ip_address' => true,
   'notification_ip_addresses' => [
   ],
]);

$response = $gateway->purchase([
   'customer' => new Customer([
      'firstName' => 'John', //phone' => '+48123456789'
   ]),
   'language' => 'pl',
   'amount' => 99.99, //ample.com/notify-url',
   'returnUrl' => 'https://example.com/return-url',
])->send();

$notification = $gateway->acceptNotification(
    options: [], // request body, if empty values are taken from httpRequest
    headers: [] // if empty values are taken from httpRequest
);

$status = $notification->getTransactionStatus();
$data = $notification->getData();
$transactionReference = $notification->getTransactionReference();

use Omnipay\Omnipay;

$gateway = Omnipay::create('Przelewy24');
$gateway->initialize([
   'posId' => '',
   'merchantId' => '',
   'crcKey' => '',
   'reportKey' => '',
   'test_mode' => false,
   'verify_ip_address' => true,
   'notification_ip_addresses' => [
   ],
]);

$response = $gateway->purchase([
   'customer' => new Customer([
      'name' => 'John Doe',
      'email' => '[email protected]', //ntry' => 'PL' //tion_id' => '1', //

$notification = $gateway->acceptNotification(
    options: [], // request body, if empty values are taken from httpRequest
    headers: [] // if empty values are taken from httpRequest
);

// Przelewy24 e = $notification->getTransactionReference();

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tpay');
$gateway->initialize([
   'merchant_id' => '',
   'service_id' => '',
   'service_key' => '',
   'auth_token' => '',
   'test_mode' => false,
   'verify_ip_address' => true,
   'notification_ip_addresses' => [
   ],
]);

$response = $gateway->purchase([
   'customer' => new Customer([
      'name' => 'John Doe', //' => 'Warszawa',
      'postcode' => '00-000',
      'phone' => '+48123456789'
      'country' => 'PL'
   ]),
   'language' => 'pl',
   'amount' => 99.99, // => 150 // 

$notification = $gateway->acceptNotification(
    options: [], // request body, if empty values are taken from httpRequest
    headers: [] // if empty values are taken from httpRequest
);

$status = $notification->getTransactionStatus();
$data = $notification->getData();
$transactionReference = $notification->getTransactionReference();