PHP code example of bileto / omnipay-tatrabank

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

    

bileto / omnipay-tatrabank example snippets


use Omnipay\Tatrabank\GatewayFactory;

$secureKey = "3132333435363738393031323334353637383930313233343536373839303132";
$gateway = GatewayFactory::createInstance($secureKey);

try {
    $merchantId = 'A1029DTmM7';
    $orderNo = '12345677';
    $returnUrl = 'http://localhost:8000/gateway-return.php';
    $description = 'Shopping at myStore.com (Lenovo ThinkPad Edge E540, Shipping with PPL)';

    $purchase = new \Omnipay\Csob\Purchase($merchantId, $orderNo, $returnUrl, $description);
    $purchase->setCart([
        new \Omnipay\Csob\CartItem("Notebook", 1, 1500000, "Lenovo ThinkPad Edge E540..."),
        new \Omnipay\Csob\CartItem("Shipping", 1, 0, "PPL"),
    ]);

    /** @var \Omnipay\Csob\Message\ProcessPaymentResponse $response */
    $response = $gateway->purchase($purchase->toArray())->send();

    // Payment init OK, redirect to the payment gateway
    echo $response->getRedirectUrl();
} catch (\Exception $e) {
    dump((string)$e);
}