Sample Code

Once you have installed one of our API wrappers (in PHP, Ruby, or Java) you can get started right away with copy-and-paste code examples.

Here is a list of the most common usage scenarios of our easy to use wrappers.

top

Welcome to iATS Developer Solutions.

Select a solution from the options to the left.

PROCESS TRANSACTIONS

Charge a Credit Card Without Using a Token

<?php
require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS

$iATS_PL = new iATS\ProcessLink($agentCode, $password);

$request = array(
    'invoiceNum' => '000001',
    'creditCardNum' => '4111111111111111',
    'creditCardExpiry' => '12/17',
    'cvv2' => '000',
    'mop' => 'VISA',
    'firstName' => 'Test',
    'lastName' => 'User',
    'address' => '1234 Any Street',
    'city' => 'City',
    'state' => 'AL',
    'zipCode' => '12345',
    'total' => '10.00',
    'currency' => 'USD',
);

//// Make the API call using the ProcessLink service.
$response = $iATS_PL->processCreditCard($request);

// Verify successful call
if (substr(trim($response['AUTHORIZATIONRESULT']),0,2) == 'OK'){
  // Perform successful call logic
}
import com.iatspayments.www.NetGate.CreateCustomerCodeAndProcessCreditCardV1;
import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ProcessCreditCardV1;
import com.iatspayments.www.NetGate.ProcessLinkService;

public class ChargeCreditCardWithoutToken {
    public static void main(String[] args) throws Exception {
        //Creates the link to the service
        ProcessLinkService processLinkService = new ProcessLinkService();

        //Creates the customer code
        CreateCustomerCodeAndProcessCreditCardV1 createcustcode = new CreateCustomerCodeAndProcessCreditCardV1("TEST88", "TEST88","123.123.123.1", "", "4222222222222220", "03/15", "John", "Smith", "West Georgia St", "BC", "AP", "500039", "", "1");

        //Creates the response which holds the customer code
        IATSResponse response = processLinkService.createCustomerCodeAndProcessCreditCard(createcustcode);

        ProcessCreditCardV1 processCreditCardV1 = new ProcessCreditCardV1();

        processCreditCardV1.setInvoiceNum("000001");
        processCreditCardV1.setCreditCardNum("4111111111111111");
        processCreditCardV1.setCreditCardExpiry("12/17");
        processCreditCardV1.setCvv2("000");
        processCreditCardV1.setMop("VISA");
        processCreditCardV1.setFirstName("Test");
        processCreditCardV1.setLastName("User");
        processCreditCardV1.setAddress("1234 Any Stree");
        processCreditCardV1.setCity("City");
        processCreditCardV1.setState("AL");
        processCreditCardV1.setZipCode("12345");
        processCreditCardV1.setTotal("10.00");

        System.out.println("Result: " + response.getProcessResult().getAuthorizationResult());

    }
}
require 'iats_payments'

# North American server:
service = ProcessLinkService.new(nil) 

# UK Server:
# service = ProcessLinkService.new("https://www.iatspayments.com/NetGate/ProcessLink.asmx");

processCard = ProcessCreditCardV1.new
processCard.agentCode = "TEST88"
processCard.password = "TEST88"
processCard.creditCardNum = "4222222222222220"
processCard.creditCardExpiry = "05/15"
processCard.cvv2 = "123"
processCard.mop = "VISA"
processCard.firstName = "John"
processCard.lastName = "Smith"
processCard.address = "West Georgia St"
processCard.city = "BC"
processCard.state = "AP"
processCard.zipCode = "1312"
processCard.total = "3"
processCard.comment = "Test"
response = service.processCreditCard(processCard)
puts response.PROCESSRESULT.TRANSACTIONID, "Generated Transaction Id"

Charge a credit card using a previously created token

<?php
require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS

$iATS_PL = new iATS\ProcessLink($agentCode, $password);

$request = array(
  'customerIPAddress' => '', // Optional. The client's IP.
  'customerCode' => $creditCardCustomerCode, // The customer code token that you generated with a previous call to iATS CustomerLink service
  'invoiceNum' => '00000001', // Optional. The invoice number for this transaction.
  'cvv2' => '000', // Optional. The customer's credit card CVV2 code.
  'mop' => 'VISA', // The customer's method of payment.
  'total' => '5.00', // The total payment amount
  'comment' => 'Process credit card test with Customer Code.', // Optional. A comment describing this transaction.
  'currency' => 'USD', // The currency to process payment in.
);

//// Make the API call using the ProcessLink service.
$response = $iATS_PL->processCreditCardWithCustomerCode($request);

// Verify successful call
if (substr(trim($response['AUTHORIZATIONRESULT']),0,2) == 'OK'){
  // Perform successful call logic.
}
import com.iatspayments.www.NetGate.CreateCustomerCodeAndProcessCreditCardV1;
import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ProcessCreditCardWithCustomerCodeV1;
import com.iatspayments.www.NetGate.ProcessLinkService;

public class ChargeCreditCardPrevToken {

    public static void main(String[] args) throws Exception {

        ProcessLinkService processLinkService = new ProcessLinkService();

        //Creates the response which holds the customer code
        ProcessCreditCardWithCustomerCodeV1 processCreditCardWithCustomerCodeV1 = new ProcessCreditCardWithCustomerCodeV1();
        processCreditCardWithCustomerCodeV1.setCustomerIPAddress("");
        processCreditCardWithCustomerCodeV1.setInvoiceNum("00000001");
        processCreditCardWithCustomerCodeV1.setCvv2("000");
        processCreditCardWithCustomerCodeV1.setTotal("5.00");
        processCreditCardWithCustomerCodeV1.setComment("Process credit card test with Customer code");
        processCreditCardWithCustomerCodeV1.setCustomerCode("");
        IATSResponse response = processLinkService.processCreditCardWithCustomerCode(processCreditCardWithCustomerCodeV1);
        processCreditCardWithCustomerCodeV1.setCustomerCode(response.getProcessResult().getCustomerCode());

        System.out.println("Result: " + response.getProcessResult().getAuthorizationResult());

    }
}
class ChargeACreditOrDebitCardUsignPrevToken
  require 'iats_payments'
  service = ProcessLink.new(nil)
  processCreditCardWithCustomerCode = ProcessCreditCardWithCustomerCode.new

  processCreditCardWithCustomerCode.customerIPAddress = ""
  processCreditCardWithCustomerCode.customerCode = customerCode
  processCreditCardWithCustomerCode.invoiceNum = "00000001"
  processCreditCardWithCustomerCode.cvv2 = "000"
  processCreditCardWithCustomerCode.mop = "VISA"
  processCreditCardWithCustomerCode.total = "5.00"
  processCreditCardWithCustomerCode.comment = "Process credit card test with Customer Code"
  processCreditCardWithCustomerCode.currency = "USD"

  response = service.processCreditCardWithCustomerCode(processCreditCardWithCustomerCode)
  puts response.AUTHORIZATIONRESULT , "Charged a card with Customer Code"

end

Process an ACH/EFT Transaction

This functionality is available for North America only as the UK does not permit single ACH transactions.

Unlike credit card processing, ACH transactions are not processed in real time.

When an ACH transaction is submitted, iATS provides a general response of OK:555555, which indicates iATS has received the transaction attempt and that the request is pending approval.
 
Please note the format for the bank account details:

  • USD: Routing no. (9 digits) + account no. (# of digits varies)
  • CAD: Bank no. (3 digits) + transit no. (5 digits) + account no. (# of digits varies)

* Order must be followed with NO spaces/dashes. Example: 12312345123456789

<?php

require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS

$iATS_PL = new iATS\ProcessLink($agentCode, $password);

$request = array(
  'customerIPAddress' => '', // Optional. The client IP.
  'invoiceNum' => '00000001', // Optional. The invoice number for this transaction.
  'accountNum' => '02100002100000000000000001', // The customer's bank account number.
  'accountType' => 'CHECKING', // The customer's bank account type.
   // Options: CHECKING, SAVING (North America only.)
  'firstName' => 'Test', // Optional. The customer's first name.
  'lastName' => 'Account', // Optional. The customer's last name.
  'address' => '1234 Any Street', // Optional. The customer's address.
  'city' => 'Schenectady', // Optional. The customer's city.
  'state' => 'NY', // Optional. The customer's state or province.
  'zipCode' => '12345', // Optional. The customer's ZIP code.
  'total' => '5', // The total payment amount.
  'comment' => 'Process ACH / EFT test.' // Optional. A comment describing this transaction.
);

// Make the API call using the ProcessLink service.
$response = $iATS_PL->processACHEFT($request);
// $response will be an array, or an API error.
// Save your transaction ID so you can check on the transaction later.
$transactionID = $response['TRANSACTIONID']; 

if (substr(trim($response['AUTHORIZATIONRESULT']),0,10) == 'OK: 555555'){
  print 'Call was successful.';
} else {
  // Handle failed transaction
  print 'An error occurred.';
}
import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ProcessLinkService;

public class ProcessAnACHEFTTransaction {
    public static void main(String[] obiwan) throws Exception{
        ProcessLinkService processLinkService = new ProcessLinkService();
        ProcessAnACHEFTTransaction processAnACHEFTTransaction = new ProcessAnACHEFTTransaction();
        processAnACHEFTTransaction.setCustomerIPAddress = "";
        processAnACHEFTTransaction.setInvoiceNum = "00000001";
        processAnACHEFTTransaction.setAccountNum = "";
        processAnACHEFTTransaction.setFirstName = "Test";
        processAnACHEFTTransaction.setLastName = "Account";
        processAnACHEFTTransaction.setAddress = "1234 Any Stree";
        processAnACHEFTTransaction.setCity = "Schenetady";
        processAnACHEFTTransaction.setState = "NY";
        processAnACHEFTTransaction.setZipCode = "12345";
        processAnACHEFTTransaction.setTotal = "5";
        processAnACHEFTTransaction.setComment = "Process ACH/EFT Test.";

        IATSResponse response = processLinkService.processACHEFT(processAnACHEFTTransaction);
        System.out.println(response.getAuthResult());
    }
}
class ProcessAnACHEFTTransaction
  require 'iats_payments'
  service processLink.new(nil)
  processACHEFT = ProcessACHEFT.new
  processACHEFT.customerIPAddress = '', // Optional. The client IP.
  processACHEFT.invoiceNum = '00000001', // Optional. The invoice number for this transaction.
  processACHEFT.accountNum = '02100002100000000000000001', // The customer's bank account number.
  processACHEFT.accountType = 'CHECKING',
  processACHEFT.firstName = 'Test', // Optional. The customer's first name.
  processACHEFT.lastName = 'Account', // Optional. The customer's last name.
  processACHEFT.address = '1234 Any Street', // Optional. The customer's address.
  processACHEFT.city = 'Schenectady', // Optional. The customer's city.
  processACHEFT.state = 'NY', // Optional. The customer's state or province.
  processACHEFT.zipCode = '12345', // Optional. The customer's ZIP code.
  processACHEFT.total = '5', // The total payment amount.
  processACHEFT.comment = 'Process ACH / EFT test.'
  
   response = service.processACHEFT(processACHEFT)
  puts response.AUTHORIZATIONRESULT

end

CREATE A CUSTOMER TOKEN

Creating customer code tokens allows future transactions to be carried out using the same credentials without the need to store sensitive credit card or ACH (direct debit) information on local servers.


Create a New Token

This service is to create a token from credit card details. This token can be used to do single transactions or used for recurring transactions where you manage the schedule.

<?php
require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS
$region = 'NA'; // NA = North America, UK = United Kingdom

// Only applies to recurring payments, but is a required parameter
$beginDate = strtotime('01/01/2014');
$endDate = strtotime('01/31/2014');

// Create and populate the request object.
$request = array(
  'customerIPAddress' => '', // The client IP.
  'customerCode' => '', // Optional. The iATS Customer Code.
  'firstName' => 'Test', // The customer's first name.
  'lastName' => 'Account', // The customer's last name.
  'companyName' => 'Test Co.', // The customer's company name.
  'address' => '1234 Any Street', // The customer's address.
  'city' => 'Schenectady', // The customer's city.
  'state' => 'NY', // The customer's state or province.
  'zipCode' => '12345', // The customer's ZIP code.
  'phone' => '555-555-1234', // The customer's phone number.
  'fax' => '555-555-4321', // The customer's FAX number.
  'alternatePhone' => '555-555-5555', // The customer's alternate phone number.
  'email' => 'email@test.co', // The customer's email address.
  'comment' => 'Customer code creation test.', // A comment describing this transaction.
  'recurring' => FALSE, // TRUE if a recurring payment should be created.
  'amount' => '5', // The payment amount.
  'beginDate' => $beginDate, // The begin date of the recurring payment, if used.
  'endDate' => $endDate, // The end date of the recurring payment, if used.
  'scheduleType' => 'Annually', // The recurring payment schedule.
   // Options: Weekly, Monthly, Quarterly, Annually.
  'scheduleDate' => '', // The recurring payment schedule date.
   // Options: Monthly: 1-28,29,30 or 31; Weekly: 1-7; Quarterly or Annually: empty string.
  'creditCardCustomerName' => 'Test Account', // The customer's name as appears on the credit card.
  'creditCardNum' => '4222222222222220', // The customer's credit card number.
  'creditCardExpiry' => '12/17', // The customer's credit card expiration date.
  'mop' => 'VISA', // Optional. The customer's method of payment.
  'currency' => 'USD', // Optional. The customer's currency.
);

//// Make the API call using the CustomerLink service.
$iATS_CL = new iATS\CustomerLink($agentCode, $password, $region);

$response = $iATS_CL->createCreditCardCustomerCode($request);

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

import java.util.GregorianCalendar;

public class CreateAToken {
    public static void main(String[] args) throws Exception {

        //Creates the customer link to the service
        CustomerLinkService customerLink = new CustomerLinkService();
        CreateCreditCardCustomerCodeV1 createCreditCardCustomerCodeV1 = new CreateCreditCardCustomerCodeV1();
        createCreditCardCustomerCodeV1.setPassword("TEST");
        createCreditCardCustomerCodeV1.setPassword("TEST88");
        createCreditCardCustomerCodeV1.setCustomerIPAddress("");
        createCreditCardCustomerCodeV1.setFirstName("Test");
        createCreditCardCustomerCodeV1.setLastName("Account");
        createCreditCardCustomerCodeV1.setCompanyName("Test Co");
        createCreditCardCustomerCodeV1.setAddress("1234 Any Stree");
        createCreditCardCustomerCodeV1.setState("NY");
        createCreditCardCustomerCodeV1.setZipCode("12345");
        createCreditCardCustomerCodeV1.setPhone("555-555-1234");
        createCreditCardCustomerCodeV1.setFax("555-555-4321");
        createCreditCardCustomerCodeV1.setAlternatePhone("555-555-5555");
        createCreditCardCustomerCodeV1.setEmail("email@test.co");
        createCreditCardCustomerCodeV1.setComment("Customer code creation test.");
        createCreditCardCustomerCodeV1.setRecurring(false);
        createCreditCardCustomerCodeV1.setAmount("5");
        createCreditCardCustomerCodeV1.setScheduleDate("");
        createCreditCardCustomerCodeV1.setScheduleType("Annually");
        createCreditCardCustomerCodeV1.setBeginDate(new GregorianCalendar());
        createCreditCardCustomerCodeV1.setEndDate(new GregorianCalendar());
        createCreditCardCustomerCodeV1.setCreditCardNum("4222222222222220");
        createCreditCardCustomerCodeV1.setCreditCardExpiry("12/17");
        createCreditCardCustomerCodeV1.setMop("VISA");

        //Creates the response which holds the customer code
        IATSResponse response = customerLink.createCreditCardCustomerCode(createCreditCardCustomerCodeV1);
        createCreditCardCustomerCodeV1.setCustomerCode(response.getProcessResult().getCustomerCode());
        System.out.println("Customer Code (Optional): " + response.getProcessResult().getCustomerCode());
        System.out.println("Authorization Result: " + response.getProcessResult().getAuthorizationResult());

    }
}
class CreateNewCustomerCodeForCreditCardTransactions
  require 'iats_payments'
  service = CustomerLinkService.new(nil)
  createCreditCardCustomerCodeV1 = CreateCreditCardCustomerCodeV1.new
  createCreditCardCustomerCodeV1.customerIPAddress = ""
  createCreditCardCustomerCodeV1.customerCode = ""
  createCreditCardCustomerCodeV1.firstName = "Test"
  createCreditCardCustomerCodeV1.lastName = ""
  createCreditCardCustomerCodeV1.companyName = "Test Co."
  createCreditCardCustomerCodeV1.address = "1234 Any Street"
  createCreditCardCustomerCodeV1.city = "Schenectady"
  createCreditCardCustomerCodeV1.state = "NY"
  createCreditCardCustomerCodeV1.zipCode = "12345"
  createCreditCardCustomerCodeV1.phone = "555-555-1234"
  createCreditCardCustomerCodeV1.fax = "555-555-4321"
  createCreditCardCustomerCodeV1.alternatePhone = "555-555-5555"
  createCreditCardCustomerCodeV1.email = "email@test.co"
  createCreditCardCustomerCodeV1.comment = "Customer code creation test"
  createCreditCardCustomerCodeV1.recurring = false
  createCreditCardCustomerCodeV1.amount = "5"
  createCreditCardCustomerCodeV1.scheduleType = "Monthly"
  createCreditCardCustomerCodeV1.creditCardCustomerName = "Test Account"
  createCreditCardCustomerCodeV1.creditCardNum = "4222222222222220"
  createCreditCardCustomerCodeV1.creditCardExpiry = "12/17"
  createCreditCardCustomerCodeV1.mop = "VISA"
  createCreditCardCustomerCodeV1.currency = "USD"

  response = service.createCreditCardCustomerCodeV1(createCreditCardCustomerCodeV1)
  puts response.PROCESSRESULT.CUSTOMERCODE, "Generated the customer code"

end

Retrieve Customer Data From a Token

This service allows you to see what information is stored against a particular token.

<?php
require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS
$region = 'NA'; // NA = North America, UK = United Kingdom

$iATS_CL = new iATS\CustomerLink($agentCode, $password, $region);

$request = array(
  'customerIPAddress' => '', // Optional. The client IP.
  'customerCode' => $creditCardCustomerCode, // The iATS customer code token you generated with a previous call to the CustomerLink service
);

//// Make the API call using the CustomerLink service.
$response = $iATS_CL->getCustomerCodeDetail($request);

// Response will be an array - either the returned data, or an API error. 
// Handle your returned data here.
import com.iatspayments.www.NetGate.*;
import java.util.GregorianCalendar;

public class RetrieveCustomerData {

    public static void main(String a[]) throws Exception {

        CustomerLinkService customerLinkService = new CustomerLinkService();

        CreateCreditCardCustomerCodeV1 createCreditCardCustomerCodeV1 = new CreateCreditCardCustomerCodeV1();

        createCreditCardCustomerCodeV1.setPassword("TEST88");
        createCreditCardCustomerCodeV1.setPassword("TEST");
        createCreditCardCustomerCodeV1.setPassword("TEST88");
        createCreditCardCustomerCodeV1.setCustomerIPAddress("");
        createCreditCardCustomerCodeV1.setFirstName("Test");
        createCreditCardCustomerCodeV1.setLastName("Account");
        createCreditCardCustomerCodeV1.setCustomerCode("");
        createCreditCardCustomerCodeV1.setCompanyName("Test Co");
        createCreditCardCustomerCodeV1.setAddress("1234 Any Stree");
        createCreditCardCustomerCodeV1.setState("NY");
        createCreditCardCustomerCodeV1.setZipCode("12345");
        createCreditCardCustomerCodeV1.setPhone("555-555-1234");
        createCreditCardCustomerCodeV1.setFax("555-555-4321");
        createCreditCardCustomerCodeV1.setAlternatePhone("555-555-5555");
        createCreditCardCustomerCodeV1.setEmail("email@test.co");
        createCreditCardCustomerCodeV1.setComment("Customer code creation test.");
        createCreditCardCustomerCodeV1.setRecurring(false);
        createCreditCardCustomerCodeV1.setAmount("5");
        createCreditCardCustomerCodeV1.setScheduleDate("");
        createCreditCardCustomerCodeV1.setScheduleType("Annually");
        createCreditCardCustomerCodeV1.setBeginDate(new GregorianCalendar());
        createCreditCardCustomerCodeV1.setEndDate(new GregorianCalendar());
        createCreditCardCustomerCodeV1.setCreditCardNum("4222222222222220");
        createCreditCardCustomerCodeV1.setCreditCardExpiry("12/17");
        createCreditCardCustomerCodeV1.setMop("VISA");

        IATSResponse response = customerLinkService.createCreditCardCustomerCode(createCreditCardCustomerCodeV1);
        System.out.println("Customer code: " + response.getProcessResult().getCustomerCode());
    }
}
class RetrieveCustomerData
  require 'iats_payments'
  service = CustomerLinkService.new(nil)
  getCustomerCodeDetail = GetCustomerCodeDetail.new

  getCustomerCodeDetail.customerIPAddress = ""
  getCustomerCodeDetail.customerCode = creditCardCustomerCode

  response = service.getCustomerCodeDetail(getCustomerCodeDetail)
end

Update a Token

This service allows you to update an existing token with new customer data, for example: a new credit card number or expiry date.

<?php
require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS
$region = 'NA'; // NA = North America, UK = United Kingdom

$iATS_CL = new iATS\CustomerLink($agentCode, $password, $region);

$request = array(
  'customerIPAddress' => '', // Optional. The client IP.
  'customerCode' => $creditCardCustomerCode, // The iATS customer code token you generated with a previous call to the CustomerLink service
  'firstName' => 'Test', // Optional. The customer's first name.
  'lastName' => 'Account', // Optional. The customer's last name.
  'companyName' => 'Test Co.', // Optional. The customer's company name.
  'address' => '1234 Any Street', // Optional. The customer's address.
  'city' => 'Schenectady', // Optional. The customer's city.
  'state' => 'NY', // Optional. The customer's state or province.
  'zipCode' => '12345', // Optional. The customer's ZIP code.
  'phone' => '555-555-1234', // Optional. Optional. The customer's phone number.
  'fax' => '555-555-4321', // Optional. The customer's FAX number.
  'alternatePhone' => '555-555-5555', // Optional. The customer's alternate phone number.
  'email' => 'email@test.co', // Optional. The customer's email address.
  'comment' => 'Customer code creation test.', // Optional. A comment describing this transaction.
  'recurring' => FALSE, // Optional. TRUE if a recurring payment should be created.
  'amount' => '5', // Optional. The payment amount.
  'beginDate' => 946684800, // Optional. The begin date of the recurring payment, if used.
  'endDate' => 946771200, // Optional. The end date of the recurring payment, if used.
  'scheduleType' => 'Annually', // Optional. The recurring payment schedule.
   // Options: Weekly, Monthly, Quarterly, Annually.
  'scheduleDate' => '', // Optional. The recurring payment schedule date.
   // Options: Monthly: 1-28,29,30 or 31; Weekly: 1-7; Quarterly or Annually: empty string.
  'creditCardCustomerName' => 'Test Account', // Optional. The customer's name as appears on the credit card.
  'creditCardNum' => '4222222222222220', // Optional. The customer's credit card number.
  'creditCardExpiry' => '12/17', // Optional. The customer's credit card expiration date.
  'mop' => 'VISA', // Optional. The customer's method of payment.
  'currency' => 'USD', // Optional. The customer's currency.
  'updateCreditCardNum' => FALSE, // Optional. TRUE when the customer's credit card number should be updated.
);


//// Make the API call using the CustomerLink service.
$response = $iATS_CL->updateCreditCardCustomerCode($request);

var_dump($response);
// Verify successful call.
if (trim($response['AUTHORIZATIONRESULT']) == 'OK')
{
  // Assign the new Customer Code to a new variable
  $creditCardCustomerCode = $response['CUSTOMERCODE'];
}
import com.iatspayments.www.NetGate.*;

import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;

public class UpdateCustomerData {

    public static void main(String[] args) throws Exception{
        CustomerLinkService customerLink = new CustomerLinkService();

        //Sets the data for the customer
        UpdateCreditCardCustomerCodeV1 updateCreditCardCustomerCodeV1 = new UpdateCreditCardCustomerCodeV1();
        updateCreditCardCustomerCodeV1.setCustomerIPAddress("123.123.123.1");
        updateCreditCardCustomerCodeV1.setPassword("TEST88");
        updateCreditCardCustomerCodeV1.setAgentCode("TEST88");
        updateCreditCardCustomerCodeV1.setCity("Schenectady");
        updateCreditCardCustomerCodeV1.setZipCode("12345");
        updateCreditCardCustomerCodeV1.setPhone("555-555-1234");
        updateCreditCardCustomerCodeV1.setFax("555-555-4321");
        updateCreditCardCustomerCodeV1.setAlternatePhone("555-555-5555");
        updateCreditCardCustomerCodeV1.setEmail("email@test.co");
        updateCreditCardCustomerCodeV1.setComment("Customer code creation test");
        updateCreditCardCustomerCodeV1.setRecurring(false);
        updateCreditCardCustomerCodeV1.setAmount("5");
        updateCreditCardCustomerCodeV1.setScheduleDate("Annually");
        updateCreditCardCustomerCodeV1.setScheduleDate("");
        updateCreditCardCustomerCodeV1.setCreditCardCustomerName("Test Account");
        updateCreditCardCustomerCodeV1.setCreditCardNum("4222222222222220");
        updateCreditCardCustomerCodeV1.setCreditCardExpiry("12/17");
        updateCreditCardCustomerCodeV1.setMop("VISA");
        updateCreditCardCustomerCodeV1.setUpdateCreditCardNum(false);
        updateCreditCardCustomerCodeV1.setBeginDate(new GregorianCalendar());
        updateCreditCardCustomerCodeV1.setEndDate(new GregorianCalendar());

        IATSResponse response = customerLink.updateCreditCardCustomerCode(updateCreditCardCustomerCodeV1);

        //Sets the customer code
        updateCreditCardCustomerCodeV1.setCustomerCode(response.getProcessResult().getCustomerCode());
        System.out.println("Authorization Result: " + response.getProcessResult().getAuthorizationResult());
        System.out.println("New Customer Code: " + response.getProcessResult().getCustomerCode());

    }
}
class UpdateCustomerData

  require 'iats_payments'

  service = CustomerLinkService.new(nil)
  updateCreditCardCustomerCode = UpdateCreditCardCustomerCode.new

  updateCreditCardCustomerCode.customerIPAddress = ""
  updateCreditCardCustomerCode.customerCode = customerCode
  updateCreditCardCustomerCode.firstName = "Test"
  updateCreditCardCustomerCode.lastName = ""
  updateCreditCardCustomerCode.companyName = "Test Co."
  updateCreditCardCustomerCode.address = "1234 Any Street"
  updateCreditCardCustomerCode.city = "Schenectady"
  updateCreditCardCustomerCode.state = "NY"
  updateCreditCardCustomerCode.zipCode = "12345"
  updateCreditCardCustomerCode.phone = "555-555-1234"
  updateCreditCardCustomerCode.fax = "555-555-4321"
  updateCreditCardCustomerCode.alternatePhone = "555-555-5555"
  updateCreditCardCustomerCode.email = "email@test.co"
  updateCreditCardCustomerCode.comment = "Customer code creation test"
  updateCreditCardCustomerCode.recurring = false
  updateCreditCardCustomerCode.amount = "5"
  updateCreditCardCustomerCode.scheduleType = "Monthly"
  updateCreditCardCustomerCode.creditCardCustomerName = "Test Account"
  updateCreditCardCustomerCode.creditCardNum = "4222222222222220"
  updateCreditCardCustomerCode.creditCardExpiry = "12/17"
  updateCreditCardCustomerCode.mop = "VISA"
  updateCreditCardCustomerCode.currency = "USD"

  response = service.updateCreditCardCustomerCode(updateCreditCardCustomerCode)
  puts response.AUTHORIZATIONRESULT, "Updated the information."

end

Create a Customer Code Token and Process an ACH/EFT Transaction (North America Only)

Unlike credit card processing, ACH transactions are not processed in real time.

When an ACH transaction is submitted, iATS provides a general response of OK:555555, which indicates iATS has received the transaction attempt and that the request is pending approval.

Please note the format for the bank account details:

    • USD: Routing no. (9 digits) + account no. (# of digits varies)

    • CAD: Bank no. (3 digits) + transit no. (5 digits) + account no. (# of digits varies)

* Order must be followed with NO spaces/dashes. Example: 12312345123456789

<?php
require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS

$iATS_PL = new iATS\ProcessLink($agentCode, $password);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '', // Optional. The client IP.
'firstName' => 'Test', // The customer's first name.
'lastName' => 'Account', // The customer's last name.
'address' => '1234 Any Street', // The customer's address.
'city' => 'Schenectady', // The customer's city.
'state' => 'NY', // The customer's state or province.
'zipCode' => '12345', // The customer's ZIP code.
'accountNum' => '02100002100000000000000001', // The customer's bank account number.
'accountType' => 'CHECKING', // The customer's bank account type.
 // Options: CHECKING, SAVING (North America only.)
'invoiceNum' => '00000001', // Optional. The invoice number for this transaction.
'total' => '5', // The total payment amount.
'comment' => 'Process ACH / EFT test.' // Optional. A comment describing this transaction.
);

// Make the API call 
$response = $iATS_PL->createCustomerCodeAndProcessACHEFT($request);

// For debugging.
var_dump($response);

// Verify successful call.
if (substr(trim($response['AUTHORIZATIONRESULT']),0,2) == 'OK'){
  print '<br/>iATS accepted the transaction';
  // Do something with your returned data
  $acheftCustomerCode = $response['CUSTOMERCODE'];
  $acheftTransactionID = $response['TRANSACTIONID'];
} else {
  // Handle failed transaction
  print '<br/>Something went wrong.';
}



import com.iatspayments.www.NetGate.*;

import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;

public class UpdateCustomerData {
 public static void main(String[] args) throws Exception{
        ProcessLinkService processLink = new ProcessLinkService();
		
		CreateCustomerCodeAndProcessACHEFT createCustomerCodeAndProcessACHEFT = new CreateCustomerCodeAndProcessACHEFT();
		createCustomerCodeAndProcessACHEFT.setCustomerIPAddress = ""
		createCustomerCodeAndProcessACHEFT.setFirstName = "Test"
		createCustomerCodeAndProcessACHEFT.setLastName = "Account"
		createCustomerCodeAndProcessACHEFT.setAddress = "1234 Any Street"
		createCustomerCodeAndProcessACHEFT.setCity = "Schenectady"
		createCustomerCodeAndProcessACHEFT.setState = "NY"
		createCustomerCodeAndProcessACHEFT.setZipCode = "12345"
		createCustomerCodeAndProcessACHEFT.setAccountNum = "02100002100000000000000001:
		createCustomerCodeAndProcessACHEFT.setAccountType = "CHECKING"
		createCustomerCodeAndProcessACHEFT.setInvoiceNum = "00000001"
		createCustomerCodeAndProcessACHEFT.setTotal = "5"
		createCustomerCodeAndProcessACHEFT.setComment = "Process ACH / EFT test."
		
		IATSResponse response = customerLink.updateCreditCardCustomerCode(updateCreditCardCustomerCodeV1);

        //Sets the customer code
        System.out.println("Authorization Result: " + response.getProcessResult().getTransactionID());
        System.out.println("New Customer Code: " + response.getProcessResult().getCustomerCode());
    }
}
class createCustomerCodeAndProcessACHEFTTransaction
  require 'iats_payments'
  
  processLink = ProcessLinkService.new(nil)
  createCustomerCodeAndProcessACHEFT = CreateCustomerCodeAndProcessACHEFT.new
  createCustomerCodeAndProcessACHEFT.customerIPAddress = ""
  createCustomerCodeAndProcessACHEFT.firstName = "Test"
  createCustomerCodeAndProcessACHEFT.lastName = "Account"
  createCustomerCodeAndProcessACHEFT.address = "1234 Any Street"
  createCustomerCodeAndProcessACHEFT.city = "Schenectady"
  createCustomerCodeAndProcessACHEFT.state = "NY"
  createCustomerCodeAndProcessACHEFT.zipCode = "12345"
  createCustomerCodeAndProcessACHEFT.accountNum = "02100002100000000000000001:
  createCustomerCodeAndProcessACHEFT.accountType = "CHECKING"
  createCustomerCodeAndProcessACHEFT.invoiceNum = "00000001"
  createCustomerCodeAndProcessACHEFT.total = "5"
  createCustomerCodeAndProcessACHEFT.comment = "Process ACH / EFT test."
  
  response = processLink.createCustomerCodeAndProcessACHEFT(createCustomerCodeAndProcessACHEFT)
  puts response.AUTHORIZATIONRESULT, "Updated the information."
  
end

CREATE A RECURRING TRANSACTION

Recurring transactions can be created in two different styles:

• iATS manages the schedule
• You (iATS Partner) manage the schedule


Partner Managed Schedule

To create a recurring transaction on a schedule that you manage yourself, the only thing you need to do is create a customer code token, and then process a transaction using that token on whatever schedule you decide.


iATS Managed Schedule

Recurring transactions are initiated by creating or updating a customer code token, setting the recurring argument to TRUE, and specifying the startDate, endDate, and scheduleType variables appropriately.

To cancel a recurring transaction, update the customer code token, setting RECURRING argument to FALSE.

/* See the Create a Token code sample page for the full example.
   The values below are the only things that need to be updated from that example 
   to create a recurring transaction. */
...
  'recurring' => TRUE, 
  'amount' => '9.99', 
  'beginDate' => strtotime('01/15/2014'),  
  'endDate' => strtotime('12/15/2014'), 
  'scheduleType' => 'Monthly', // can be one of Weekly, Monthly, Quarterly or Annually.
    'scheduleDate' => '15', // The recurring payment schedule date.
                          // Monthly: 1~31; 
                          // Weekly: 1~7; 
                          // Quarterly or Annually: empty string
... 
import com.iatspayments.www.NetGate.*;

import java.util.GregorianCalendar;

public class CreateRecurringTransaction {
    public static void main(String[] args) throws Exception {

        //Creates the customer link to the service
        CustomerLinkService customerLink = new CustomerLinkService();

        CreateCreditCardCustomerCodeV1 createCreditCardCustomerCodeV1 = new CreateCreditCardCustomerCodeV1();
        createCreditCardCustomerCodeV1.setPassword("TEST");
        createCreditCardCustomerCodeV1.setPassword("TEST88");
        createCreditCardCustomerCodeV1.setCustomerCode("");
        createCreditCardCustomerCodeV1.setCustomerIPAddress("");
        createCreditCardCustomerCodeV1.setFirstName("Test");
        createCreditCardCustomerCodeV1.setLastName("Account");
        createCreditCardCustomerCodeV1.setCompanyName("Test Co");
        createCreditCardCustomerCodeV1.setAddress("1234 Any Stree");
        createCreditCardCustomerCodeV1.setState("NY");
        createCreditCardCustomerCodeV1.setZipCode("12345");
        createCreditCardCustomerCodeV1.setPhone("555-555-1234");
        createCreditCardCustomerCodeV1.setFax("555-555-4321");
        createCreditCardCustomerCodeV1.setAlternatePhone("555-555-5555");
        createCreditCardCustomerCodeV1.setEmail("email@test.co");
        createCreditCardCustomerCodeV1.setComment("Customer code creation test.");
        createCreditCardCustomerCodeV1.setRecurring(false);
        createCreditCardCustomerCodeV1.setAmount("5");
        createCreditCardCustomerCodeV1.setScheduleDate("");
        createCreditCardCustomerCodeV1.setScheduleType("Annually");
        createCreditCardCustomerCodeV1.setBeginDate(new GregorianCalendar());
        createCreditCardCustomerCodeV1.setEndDate(new GregorianCalendar());
        createCreditCardCustomerCodeV1.setCreditCardNum("4222222222222220");
        createCreditCardCustomerCodeV1.setCreditCardExpiry("12/17");
        createCreditCardCustomerCodeV1.setMop("VISA");
        createCreditCardCustomerCodeV1.setRecurring(true);
        createCreditCardCustomerCodeV1.setAmount("9.99");
        createCreditCardCustomerCodeV1.setBeginDate(new GregorianCalendar());
        createCreditCardCustomerCodeV1.setEndDate(new GregorianCalendar());
        createCreditCardCustomerCodeV1.setScheduleType("Monthly");


        //Creates the response which holds the customer code
        IATSResponse response = customerLink.createCreditCardCustomerCode(createCreditCardCustomerCodeV1);
        System.out.println("Result: " + response.getProcessResult().getAuthorizationResult());

    }
}
.......

   createCreditCardCustomerCodeV1.recurringPayment = TRUE
   createCreditCardCustomerCodeV1.amount = "9.99"
   createCreditCardCustomerCodeV1.beginDate = Time.new()
   createCreditCardCustomerCodeV1.endDate = Time.new()
   createCreditCardCustomerCodeV1.scheduleType = "Monthly"
   createCreditCardCustomerCodeV1.scheduleDate = "15"

....

REFUND A CHARGE

Hint: See the Testing Info & Data page for testing refunds.

Refund a Specific Credit Card Transaction

 

<?php

require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS

$iATS_PL = new iATS\ProcessLink($agentCode, $password);

// Create and populate the request object.
$request = array(
  'customerIPAddress' => '', // Optional. The client's IP.
  'transactionId' => '0000001', // The ID of the transaction to refund.
  'mop' => 'VISA', // The customer's method of payment.
  'total' => '-10', // The total amount to refund. Must be a negative number.
  'currency' => 'USD', // The currency to process payment in.
  'comment' => 'Credit card refund test.' // Optional. A comment describing this transaction.
);


//// Make the API call 
$response = $iATS_PL->processCreditCardRefundWithTransactionId($request);

// Handle your returned data here.
var_dump($response);

import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ProcessCreditCardRefundWithTransactionIdV1;
import com.iatspayments.www.NetGate.ProcessLinkService;

public class RefundCharge {
    public static void main(String[] args) throws Exception {
        ProcessLinkService processLinkService = new ProcessLinkService();
        ProcessCreditCardRefundWithTransactionIdV1 processCreditCardRefundWithTransactionIdV1 = new ProcessCreditCardRefundWithTransactionIdV1();

        processCreditCardRefundWithTransactionIdV1.setCustomerIPAddress("");
        processCreditCardRefundWithTransactionIdV1.setTransactionId("0000001");
        processCreditCardRefundWithTransactionIdV1.setTotal("-10");
        processCreditCardRefundWithTransactionIdV1.setComment("Credit Card refund test");

        IATSResponse response = processLinkService.processCreditCardRefundWithTransactionId(processCreditCardRefundWithTransactionIdV1);

        System.out.println(response.getProcessResult().getAuthorizationResult());

    }
}
class refundSpecificCreditCardTransaction

  require 'iats_payments'
  
  processLink = ProcessLinkService.new(nil)
  processCreditCardRefundWithTransactionIdV1 = processCreditCardRefundWithTransactionIdV1.new
  processCreditCardRefundWithTransactionIdV1.customerIPAddress = ""
  processCreditCardRefundWithTransactionIdV1.transactionID = "00000001"
  processCreditCardRefundWithTransactionIdV1.mop = "VISA"
  processCreditCardRefundWithTransactionIdV1.total = "-10"
  processCreditCardRefundWithTransactionIdV1.currency = "USD"
  processCreditCardRefundWithTransactionIdV1.comment = "Credit Card refund test."
  
  response = processLink.processCreditCardRefundWithTransactionIdV1(processCreditCardRefundWithTransactionIdV1)
  puts response.AUTHORIZATIONRESULT, "Updated the information."
end

Refund an ACH Transaction

North America only.

 

<?php

require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS

$iATS_PL = new iATS\ProcessLink($agentCode, $password);

// Create and populate the request object.
$request = array(
'customerIPAddress' => '', // Optional. The client IP.
'transactionId' => '0000001', // The ID of the transaction to refund.
'total' => '-10', // The amount to refund. Must be a negative number.
'comment' => 'ACH / EFT refund test.' // Optional. A comment describing this transaction.
);


//// Make the API call 
$response = $iATS_PL->processACHEFTRefundWithTransactionId($request);

// Handle your returned data
var_dump($response);
import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ProcessACHEFTRefundWithTransactionIdV1;
import com.iatspayments.www.NetGate.ProcessLinkService;

public class RefundACHEFTTransaction {
    public static void main(String[] args) throws Exception {
        ProcessLinkService processLinkService = new ProcessLinkService();
        ProcessACHEFTRefundWithTransactionIdV1 processACHEFTRefundWithTransactionIdV1 = new ProcessACHEFTRefundWithTransactionIdV1();
        processACHEFTRefundWithTransactionIdV1.setCustomerIPAddress("");
        processACHEFTRefundWithTransactionIdV1.setTransactionId("00000001");
        processACHEFTRefundWithTransactionIdV1.setTotal("-10");
        processACHEFTRefundWithTransactionIdV1.setComment("ACH / EFT refund test.");

        IATSResponse response = processLinkService.processACHEFTRefundWithTransactionId(processACHEFTRefundWithTransactionIdV1);
        System.out.println(response.getProcessResult().getAuthorizationResult());
    }
}
class refundACHEFTTransaction 
  require 'iats_payments'
  processLink = ProcessLinkService.new(nil)
  processACHEFTRefundWithTransactionId = ProcessACHEFTRefundWithTransactionId.new
  processACHEFTRefundWithTransactionId.customerIPAddress = ""
  processACHEFTRefundWithTransactionId.transactionID = "0000001"
  processACHEFTRefundWithTransactionId.total = "-10"
  processACHEFTRefundWithTransactionId.comment = "ACH / EFT refund test."
  
  response = processLink.processACHEFTRefundWithTransactionId(processACHEFTRefundWithTransactionId)
  puts response.AUTHORIZATIONRESULT, "Updated the information."
end

GENERATE A REPORT

The iATS ReportLink component of the iATS Web Services suite allows you to generate transaction reports for the majority of the services available from the iATS system, giving you easy access to the status and effectiveness of your donation forms.

All reports have the option as being returned as CSV.

Available reports for ACH / EFT include:

• Bank Reconciliation
• Approved Transactions
• Rejected Transactions
• Rejected Aura Transactions
• Returns

Available reports for Credit Card Include:

• Bank Reconciliation
• Approved Transactions
• Rejected Transactions
• Approved Aura Transactions
• Rejected Aura Transactions

Get Credit Card Payment Box Approved Transactions CSV Report

<?php
require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS

$iATS_RL = new iATS\ReportLink($agentCode, $password);

$fromDate = strtotime('06/01/2014'); 
$toDate = strtotime('07/31/2014');

// Create and populate the request object.
$request = array(
  'fromDate' => $fromDate,
  'toDate' => $toDate,
  'customerIPAddress' => '', // Optional
);


//// Make the API call using the ReportLink service.
$response = $iATS_RL->getCreditCardPaymentBoxJournalCSV($request);

// Response should be CSV string data starting with "Transaction ID,Invoice Number,Date Time"
// Handle your returned data here.
import com.iatspayments.www.NetGate.GetCreditCardPaymentBoxJournalCSVV1;
import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ReportLinkService;

import java.util.GregorianCalendar;

public class GenerateAReport {
    public static void main(String[] args) throws Exception{
        ReportLinkService reportLinkService = new ReportLinkService();
        GetCreditCardPaymentBoxJournalCSVV1 getCreditCardPaymentBoxJournalCSVV1 = new GetCreditCardPaymentBoxJournalCSVV1();

        getCreditCardPaymentBoxJournalCSVV1.setFromDate(new GregorianCalendar());
        getCreditCardPaymentBoxJournalCSVV1.setToDate(new GregorianCalendar());
        getCreditCardPaymentBoxJournalCSVV1.setCustomerIPAddress("");

        IATSResponse response = reportLinkService.getCreditCardPaymentBoxJournalCSV(getCreditCardPaymentBoxJournalCSVV1);
        System.out.println(response.getProcessResult());
    }
}
class GenerateAReport
  service = ReportLink.new(nil)
  getCreditCardPaymentBoxJournalCSV = GetCreditCardPaymentBoxJournalCSV.new
  getCreditCardPaymentBoxJournalCSV.fromDate = fromDate
  getCreditCardPaymentBoxJournalCSV.toDate = toDate
  getCreditCardPaymentBoxJournalCSV.customerIPAddress = ""

  response = service.getCreditCardPaymentBoxJournalCSV(getCreditCardPaymentBoxJournalCSV)
end

Get An ACH/EFT Rejection Report As CSV

<?php
require 'iATS/iATS.php';
$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS
$iATS_RL = new iATS\ReportLink($agentCode, $password);
$date = strtotime('07/01/2014'); 
$request = array(
  'date' => $date, // The date to gather report data for 
  'customerIPAddress' => '' // Optional. The client's IP.
);
$response = $iATS_RL->getACHEFTRejectCSV($request);
// Handle your returned data here.
// Response will be a CSV string, or an API error
// If you want the report data as an array, use "getACHEFTReject($request)" instead
import com.iatspayments.www.NetGate.GetACHEFTRejectCSVV1;
import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ReportLinkService;

import java.util.GregorianCalendar;

public class getAnACHEFTRejectionReportAsCSV {
    public static void main(String[] args) throws Exception {
        ReportLinkService reportLinkService = new ReportLinkService();

        GetACHEFTRejectCSVV1 getACHEFTRejectCSVV1 = new GetACHEFTRejectCSVV1();
        getACHEFTRejectCSVV1.setAgentCode("TEST88");
        getACHEFTRejectCSVV1.setPassword("TEST88");
        getACHEFTRejectCSVV1.setDate(new GregorianCalendar());

        IATSResponse response = reportLinkService.getACHEFTRejectCSV(getACHEFTRejectCSVV1);
    }
}
class GetAnACHEFTRejectionReportASCSV
  require 'iats_payments'

  service = ReportLink.new(nil)

  getACHEFTRejectCSV = GetACHEFTRejectCSV.new
  getACHEFTRejectCSV.agentCode = 'TEST88'
  getACHEFTRejectCSV.password = 'TEST88'

  response = service.getACHEFTRejectCSV(getACHEFTRejectCSV)
end

Get ACH/EFT Bank Reconciliation CSV Report

<?php
require 'iATS/iATS.php';
$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS
$iATS_RL = new iATS\ReportLink($agentCode, $password);
$fromDate = strtotime('06/01/2014'); 
$toDate = strtotime('06/30/2014');
$request = array(
  'fromDate' => $fromDate, // The earliest date to gather report data for.
  'toDate' => $toDate, // The latest date to gather report data for.
  'currency' => 'USD', // The currency to represent financial data as.
   // North America options: CAD, USD
   // UK options: USD, EUR, GBP, IEE, CHF, HKD, JPY, SGD, MXN
  'summaryOnly' => FALSE, // True when a summerized report is required.
  'customerIPAddress' => '' // Optional. The client's IP.
);
$response = $iATS_RL->getACHEFTBankReconciliationReportCSV($request);
// Handle your returned data here.
// Response will be CSV string data or an API error
import com.iatspayments.www.NetGate.GetACHEFTBankReconciliationReportCSVV1;
import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ReportLinkService;

import java.util.GregorianCalendar;

public class GetACHEFTBankReconciliationCSVReport {
    public static void main(String[] yoda) throws Exception {
        ReportLinkService reportLinkService = new ReportLinkService();
        GetACHEFTBankReconciliationReportCSVV1 getACHEFTBankReconciliationReportCSVV1 = new GetACHEFTBankReconciliationReportCSVV1();
        getACHEFTBankReconciliationReportCSVV1.setAgentCode("TEST88");
        getACHEFTBankReconciliationReportCSVV1.setPassword("TEST88");
        getACHEFTBankReconciliationReportCSVV1.setFromDate(new GregorianCalendar());
        getACHEFTBankReconciliationReportCSVV1.setToDate(new GregorianCalendar());

        IATSResponse response = reportLinkService.getACHEFTBankReconciliationReportCSV(getACHEFTBankReconciliationReportCSVV1);

    }
}
class GetACHEFTBankReconciliationCSVReport
  require 'iats_payments'

    service = ReportLink.new(nil)

    getACHEFTBankReconciliationReportCSV = GetACHEFTBankReconciliationReportCSV.new
    getACHEFTBankReconciliationReportCSV.agentCode = 'TEST88'
    getACHEFTBankReconciliationReportCSV.password = 'TEST88'
    getACHEFTBankReconciliationReportCSV.fromDate = fromDate
    getACHEFTBankReconciliationReportCSV.toDate = toDate
    response = service.getACHEFTBankReconciliationReportCSV(getACHEFTBankReconciliationReportCSV)
  end

BATCH PROCESSING

 

FILE FORMATS 

1. U.S. and U.K. Credit Cards - Without using customer codes

Date, Invoice, First Name, Last Name, Street, City, State, Zip Code, Amount, MOP, Credit Card #, Expiry

Example:

10/28/11, 00001,Joe,Smith,123 Any St,Anytown,ST,10023,25.00,AMX,300000000000001,0708 

 

2. Canadian Credit Cards - Without Using Customer Codes

Date, Invoice, Full Name, Amount, MOP, Credit Card #, Expiry

Example:

10/28/11, 00001,JoeSmith,25.00,AMX,300000000000001,0708 

 

3. All Currencies - Using Customer Codes (North America & UK)

Invoice Number, Customer Code, Amount, Comment

Example:

a123467,A168786,1.10,comment1 

 

4. Format Notes

• If any fields must be omitted (the invoice number for example), the comma separators must still be included. Example:

10/28/11,,Joe,Smith,123 Any St,Anytown,ST,10023,25.00,AMX,300000000000001,0708 

• Credit Card Abbreviations must all be capitalized:

North America - VISA, MC, AMX, DSC
United Kingdom - VISA, MC, AMX, MAESTR

 

PROCESS A BATCH

The "sample-batch-with-customer-codes.csv" file in the example below uses the "With Customer Codes" CSV format, and consists of the following data:

1234567890,A11718222,10,comment on first transaction
1234567891,A11718224,50,this is another transaction

You'll want to replace the invoice numbers (first column) and customer codes (second column, assigned by iats) with unique data for testing.

<?php
require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS

$iATS_PL = new iATS\ProcessLink($agentCode, $password);
$file_contents = file_get_contents('./sample-batch-with-customer-codes.csv'); 
if(!$file_contents){
  die('file could not be read'); // You will want to handle this more elegantly obviously. 
}
$base64_encoded_csv = base64_encode($file_contents);
$request = array(
  'customerIPAddress' => '', // Optional. The client's IP.
  'batchFile' => $file_contents // CSV file - the documentation calls for this to be encoded as base64, but it doesnt seem to work that way. Just a raw CSV string works.
  /*
  File format without Customer Codes for US and UK clients:
     Date, Invoice #, First Name, Last Name, Street, City, State, Zip Code, Amount, MOP, Credit Card #, Expiry
     
  File format without Customer Codes for Canadian clients:
     Date, Invoice #, Full Name, Amount, MOP, Credit Card #, Expiry
     
  File format with Customer Codes:
     Invoice #, Customer Code, Amount, Comment
  */
);

//// Make the API call using the ProcessLink service. 
$response = $iATS_PL->processCreditCardBatch($request);

// For debugging
var_dump($response);

// Store the returned batch ID and check on the results with it later.
$batch_id = $response['BATCHID']; 

import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ProcessCreditCardBatchV1;
import com.iatspayments.www.NetGate.ProcessLinkService;
import sun.misc.IOUtils;

import javax.xml.bind.JAXBException;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;

public class processABatch {
    public static void main(String[] args) throws JAXBException, RemoteException {
            ProcessLinkService processLinkService = new ProcessLinkService();
        String contents = getContents("sample-batch-with-customer-codes.csv", "base64_encode");
        ProcessCreditCardBatchV1 processCreditCardBatchV1 = new ProcessCreditCardBatchV1();
        processCreditCardBatchV1.setCustomerIPAddress("");
        processCreditCardBatchV1.getBatchFile();

        processLinkService.processCreditCardBatch(processCreditCardBatchV1);
        IATSResponse response = processLinkService.processCreditCardBatch(processCreditCardBatchV1);
    }

    public static String getContents(String url, String encodeType) {
        URL u;
        StringBuilder builder = new StringBuilder();
        try {
            u = new URL(url);
            try {
                BufferedReader theHTML = new BufferedReader(new InputStreamReader(u.openStream(), encodeType));
                String thisLine;
                while ((thisLine = theHTML.readLine()) != null) {
                    builder.append(thisLine).append("\n");
                }
            }
            catch (Exception e) {
                System.err.println(e);
            }
        } catch (MalformedURLException e) {
            System.err.println(url + " is not a parseable URL");
            System.err.println(e);
        }
        return builder.toString();
    }
}
class ProcessABatch
  require 'iats_payments'
  require 'open-uri'
  require 'base64'
  service = ProcessLink.new(nil)
  processCreditCardBatch = ProcessCreditCardBatch.new
  processCreditCardBatch.customerIPAddress = ""
  file_contents = open('sample-batch-with-customer-codes.csv').read
  base64_encoded_csv = Base64.encode64(file_contents);
  processCreditCardBatch.setCustomerIPAddress = ""
  processCreditCardBatch.batchFile = file_contents



  response = service.processCreditCardBatch(processCreditCardBatch)

  batch_id = response.BatchID

end

REQUEST BATCH PROCESS RESULTS

Batch results consist of the data you sent, with a result and transaction ID appended to each row. The example below returned the following data:

1234567890,A11718222,10,comment on first transaction,OK: 678594:
1234567891,A11718224,50,this is another transaction,OK: 678594:
<?php
require 'iATS/iATS.php';

$agentCode = 'TEST88'; // Assigned by iATS
$password = 'TEST88'; // Assigned by iATS

$iATS_PL = new iATS\ProcessLink($agentCode, $password);

$request = array(
  'customerIPAddress' => '', // Optional. The client's IP.
  'batchId' => $batch_id // The ID of the existing iATS batch process which was returned by processCreditCardBatch() in a previous step
);


//// Make the API call using the ProcessLink service.
$response = $iATS_PL->getBatchProcessResultFile($request);

$result_message = $response['AUTHORIZATIONRESULT'];
$base64_encoded_content = $response['BATCHPROCESSRESULTFILE'];

// CSV content will be what you submitted, but with a status message & code appended to each line. 
$batch_result_csv_content = base64_decode($base64_encoded_content);

// The meat of the results ... 
var_dump($batch_result_csv_content);
import com.iatspayments.www.NetGate.GetBatchProcessResultFileV1;
import com.iatspayments.www.NetGate.IATSResponse;
import com.iatspayments.www.NetGate.ProcessLinkService;
import sun.misc.BASE64Decoder;

import java.io.IOException;
import java.io.InputStream;

public class requestBatchProcessResults{
    public static void main(String[] args) throws Exception {
        ProcessLinkService processLinkService = new ProcessLinkService();
        GetBatchProcessResultFileV1 getBatchProcessResultFileV1 = new GetBatchProcessResultFileV1();
        getBatchProcessResultFileV1.setCustomerIPAddress("");
        getBatchProcessResultFileV1.setBatchId("");

        IATSResponse response = processLinkService.getBatchProcessResultFile(getBatchProcessResultFileV1);
        String resultMessage = response.getAuthResult().getAuthStatus();
        String base64EncodedContent = response.getBatchResult().getBatchprocessResultFile();

        BASE64Decoder decoder = new BASE64Decoder();
        byte[] decodedBytes = decoder.decodeBuffer(base64EncodedContent);
        System.out.println(decodedBytes);
    }
}
class requireBatchProcessResult
  require 'iats_payments'
  service = processLink.new(nil)
  getBatchProcessResultFile = GetBatchProcessResultFile.new
  getBatchProcessResultFile.customerIPAddress = ""
  getBatchProcessResultFile.batchID = ""

  response = service.getBatchProcessResultFile(getBatchProcessResultFile)
  result_message = response.getAuthorizationResult
  base64_encoded_content = response.getBatchProcessresultFile
  batch_result_csv_content = Base64.decode64(base64_encoded_content)

end