PHP code example of unionco / omnipay-paytrace

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

    

unionco / omnipay-paytrace example snippets


$ccGateway = \Omnipay\Omnipay::create('Paytrace_CreditCard');
$ccGateway->setUserName('demo123')
	->setPassword('demo123')
	->setTestMode(true);

$creditCardData = ['number' => '4242424242424242', 'expiryMonth' => '6', 'expiryYear' => '2016', 'cvv' => '123'];
$response = $ccGateway->purchase(['amount' => '10.00', 'currency' => 'USD', 'card' => $creditCardData])->send();

if ($response->isSuccessful()) {
	// SUCCESS
    echo $response->getMessage();
} else {
	// FAIL
    echo $response->getMessage();
}

$chGateWay = \Omnipay\Omnipay::create('Paytrace_Check');
$chGateway->setUserName('demo123')
	->setPassword('demo123')
	->setTestMode(true);

$checkData = ['routingNumber' => '325070760', 'bankAccount' => '1234567890', 'name' => 'John Doe'];
$response = $chGateway->purchase(['amount' => '10.00', 'currency' => 'USD', 'check' => $checkData])->send();

if ($response->isSuccessful()) {
	// SUCCESS
    echo $response->getMessage();
} else {
	// FAIL
    echo $response->getMessage();
}