PHP code example of clippings / omnipay-emp

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

    

clippings / omnipay-emp example snippets


$gateway = Omnipay::create('eMerchantPay');
$gateway->setApiKey('abc123');
$gateway->setClientId('abc123');

$threatmatrix = new Threatmatrix('organiazation id', 'client id');
$gateway->setThreatmatrix($threatmatrix);

$purchase = $gateway->purchase(array(
    'currency' => 'GBP',
    'transactionReference' => 'referenceID1',
    'clientIp' => '95.87.212.88',
    'items' => array(
        array(
            'name' => 10,
            'price' => '5.00',
            'description' => 'Product 1 Desc',
            'quantity' => 2
        ),
        array(
            'name' => 12,
            'price' => '5.00',
            'description' => 'Shipping for Product 1',
            'quantity' => 1
        ),
        array(
            'name' => 12,
            'price' => '0.00',
            'description' => 'Promotion',
            'quantity' => 1
        ),
    ),
    'card' => array(
        'firstName' => 'Example',
        'lastName' => 'User',
        'number' => '4111111111111111',
        'expiryMonth' => 7,
        'expiryYear' => 2013,
        'cvv' => 123,
        'address1' => '123 Shipping St',
        'address2' => 'Shipsville',
        'city' => 'Shipstown',
        'postcode' => '54321',
        'state' => 'NY',
        'country' => 'US',
        'phone' => '(555) 987-6543',
        'email' => '[email protected]',
    )
));

$refund = $gateway->refund(array(
    'amount' => '200.00',
    'description' => 'Faulty Product',
    'transactionReference' => '51711614',
    'transactionId' => '1413980404',
));

$refund = $gateway->refund(array(
    'items' => array(
        array(
            'name' => '51945994',
            'price' => '10.00',
        ),
        array(
            'name' => '51946004',
            'price' => '5.00',
        )
    ),
    'description' => 'Faulty Product',
    'transactionReference' => '51711614',
    'transactionId' => '1413980404',
));