PHP code example of futureecom / omnipay-tranzila

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

    

futureecom / omnipay-tranzila example snippets


use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->authorize([
    'amount' => '10.00',
    'currency' => 'ILS',
    'card' => [
        'number' => '4111111111111111',
        'expiryMonth' => '12',
        'expiryYear' => '2025',
        'cvv' => '123'
    ]
])->send();

if ($response->isSuccessful()) {
    // authorization was successful: update database
    $transactionReference = $response->getTransactionReference();
    print_r($response);
} else {
    // authorization failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->authorize([
    'amount' => '10.00',
    'currency' => 'ILS',
    'token' => 'U99e9abcd81c2ca4444',
    'expiryMonth' => 12,
    'expiryYear' => 2025
])->send();

if ($response->isSuccessful()) {
    // authorization was successful: update database
    $transactionReference = $response->getTransactionReference();
    print_r($response);
} else {
    // authorization failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->capture([
    'amount' => '10.00',
    'currency' => 'ILS',
    'transactionReference' => '12345', // The transaction reference from the authorization
    'authorizationNumber' => 'AUTH123', // Authorization number from the original transaction
    'token' => 'U99e9abcd81c2ca4444', // Token from the original transaction
    'expiryMonth' => 12,
    'expiryYear' => 2025
])->send();

if ($response->isSuccessful()) {
    // capture was successful: update database
    $transactionReference = $response->getTransactionReference();
    print_r($response);
} else {
    // capture failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->capture([
    'amount' => '10.00',
    'currency' => 'ILS',
    'transactionReference' => '12345', // The transaction reference from the authorization
    'authorizationNumber' => 'AUTH123', // Authorization number from the original transaction
    'card' => [
        'number' => '4111111111111111',
        'expiryMonth' => '12',
        'expiryYear' => '2025',
        'cvv' => '123'
    ]
])->send();

if ($response->isSuccessful()) {
    // capture was successful: update database
    $transactionReference = $response->getTransactionReference();
    print_r($response);
} else {
    // capture failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->void([
    'transactionReference' => '12345', // The transaction reference to void
    'authorizationNumber' => 'AUTH123' // Authorization number from the original transaction
])->send();

if ($response->isSuccessful()) {
    // void was successful: update database
    $transactionReference = $response->getTransactionReference();
    print_r($response);
} else {
    // void failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->reversal([
    'amount' => '1.00',
    'currency' => 'ILS',
    'transactionReference' => '12345', // The transaction reference to reverse
    'authorizationNumber' => 'AUTH123', // Authorization number from the original transaction
    'token' => 's0fc7b9882e722b0691', // Token from the original transaction
    'expiryMonth' => 11,
    'expiryYear' => 2028
])->send();

if ($response->isSuccessful()) {
    // reversal was successful: update database
    $transactionReference = $response->getTransactionReference();
    print_r($response);
} else {
    // reversal failed: display message to customer
    echo $response->getMessage();
}

$response = $gateway->reversal([
    'amount' => '1.00',
    'currency' => 'ILS',
    'transactionReference' => '12345',
    'authorizationNumber' => 'AUTH123',
    'card' => [
        'number' => '4111111111111111',
        'expiryMonth' => '11',
        'expiryYear' => '2028',
        'cvv' => '123'
    ]
])->send();

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->verify([
    'amount' => '10.00',
    'currency' => 'ILS',
    'card' => [
        'number' => '4111111111111111',
        'expiryMonth' => '12',
        'expiryYear' => '2025',
        'cvv' => '123'
    ]
])->send();

if ($response->isSuccessful()) {
    // verification was successful: update database
    $transactionReference = $response->getTransactionReference();
    print_r($response);
} else {
    // verification failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->verify([
    'amount' => '10.00',
    'currency' => 'ILS',
    'token' => 'U99e9abcd81c2ca4444',
    'expiryMonth' => 12,
    'expiryYear' => 2025
])->send();

if ($response->isSuccessful()) {
    // verification was successful: update database
    $transactionReference = $response->getTransactionReference();
    print_r($response);
} else {
    // verification failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->purchase([
    'amount' => '10.00',
    'currency' => 'ILS',
    'card' => [
        'number' => '4111111111111111',
        'expiryMonth' => '12',
        'expiryYear' => '2025',
        'cvv' => '123'
    ]
])->send();

if ($response->isSuccessful()) {
    // payment was successful: update database
    print_r($response);
} else {
    // payment failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->purchase([
    'amount' => '10.00',
    'currency' => 'ILS',
    'token' => 'U99e9abcd81c2ca4444',
    'expiryMonth' => 12,
    'expiryYear' => 2025
])->send();

if ($response->isSuccessful()) {
    // payment was successful: update database
    print_r($response);
} else {
    // payment failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->refund([
    'amount' => '10.00',
    'currency' => 'ILS',
    'transactionReference' => '12345',
    'authorizationNumber' => 'AUTH123',
    'token' => 'U99e9abcd81c2ca4444',
    'expiryMonth' => 12,
    'expiryYear' => 2025
])->send();

if ($response->isSuccessful()) {
    // refund was successful: update database
    print_r($response);
} else {
    // refund failed: display message to customer
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setAppKey('your_app_key');
$gateway->setSecret('your_secret');
$gateway->setTerminalName('your_terminal_name');

$response = $gateway->refund([
    'amount' => '10.00',
    'currency' => 'ILS',
    'transactionReference' => '12345',
    'authorizationNumber' => 'AUTH123',
    'card' => [
        'number' => '4111111111111111',
        'expiryMonth' => '12',
        'expiryYear' => '2025',
        'cvv' => '123'
    ]
])->send();

if ($response->isSuccessful()) {
    // refund was successful: update database
    print_r($response);
} else {
    // refund failed: display message to customer
    echo $response->getMessage();
}

$gateway->setTerminalPassword('your_terminal_password');

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setTerminalName('your_terminal_name');
$gateway->setTerminalPassword('your_terminal_password');

$response = $gateway->handshake([
    'amount' => '10.00',
])->send();

if ($response->isSuccessful()) {
    $handshakeToken = $response->getHandshakeToken();
    print_r($response->getResponseData());
} else {
    echo $response->getMessage();
}

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tranzila');
$gateway->setTerminalName('your_terminal_name');
$gateway->setTerminalPassword('your_terminal_password');

$response = $gateway->handshake([
    'amount' => '10.00',
])->send();

if ($response->isSuccessful()) {
    // Get the handshake token for iframe usage
    $handshakeToken = $response->getHandshakeToken();
    // Or get a structured array with all details
    $data = $response->getResponseData();
    print_r($data);
} else {
    // handshake failed: display message to customer
    echo $response->getMessage();
}