PHP code example of iatspayments / php

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

    

iatspayments / php example snippets




// Create and populate the request object.
$request = array(
  'customerIPAddress' => '',
  'customerCode' => '',
  'firstName' => 'Test',
  'lastName' => 'Account',
  'companyName' => 'Test Co.',
  'address' => '1234 Any Street',
  'city' => 'City',
  'state' => 'NY',
  'zipCode' => '12345',
  'phone' => '555-555-1234',
  'fax' => '555-555-4321',
  'alternatePhone' => '555-555-5555',
  'email' => '[email protected]',
  'comment' => 'Customer code creation test.',
  'recurring' => FALSE,
  'amount' => '5',
  'beginDate' => '2014-07-01T00:00:00+00:00',
  'endDate' => '2014-08-01T00:00:00+00:00',
  'scheduleType' => 'Annually',
  'scheduleDate' => '',
  'creditCardCustomerName' => 'Test Account',
  'creditCardNum' => '4222222222222220',
  'creditCardExpiry' => '12/17',
  'mop' => 'VISA',
  'currency' => 'USD',
);

// Replace with your iATS API credentials.
$agentCode = 'TEST88';
$password = 'TEST88';

// Make the API call using the CustomerLink service.
$iats = new CustomerLink($agentCode, $password, 'NA');
$response = $iats->createCreditCardCustomerCode($request);

// Verify successful call.
if (trim($response['AUTHORIZATIONRESULT']) == 'OK')
{
  // Assign the new Customer Code to a new variable.
  $creditCardCustomerCode = $response['CUSTOMERCODE'];

  // Perform successful call logic.
}



// Create and populate the request object.
$request = array(
  'customerIPAddress' => '',
  'customerCode' => self::$creditCardCustomerCode,
  'invoiceNum' => '00000001',
  'cvv2' => '000',
  'mop' => 'VISA',
  'total' => '5',
  'comment' => 'Process CC test with Customer Code.',
  'currency' => 'USD',
);

// Replace with your iATS API credentials.
$agentCode = 'TEST88';
$password = 'TEST88';

// Make the API call using the ProcessLink service.
$iats = new ProcessLink($agentCode, $password);
$response = $iats->processCreditCardWithCustomerCode($request);

// Verify successful call.
if (trim($response['AUTHORIZATIONRESULT']) == 'OK')
{
  // Perform successful call logic.
}



// Create and populate the request object.
$request = array(
  'fromDate' => '2014-07-01T00:00:00+00:00',
  'toDate' => '2014-08-01T00:00:00+00:00',
  'customerIPAddress' => '',
);

// Replace with your iATS API credentials.
$agentCode = 'TEST88';
$password = 'TEST88';

// Make the API call using the ReportLink service.
$iats = new ReportLink($agentCode, $password);
$response = $iats->getCreditCardPaymentBoxJournalCSV($request);

// Response should be CSV data starting with "Transaction ID,Invoice Number,Date Time"