Live Support Agent

Tutorial: Create a Check with ACHeck21 PHP API

Ryan Ackley -

Before getting started with this tutorial, make sure you have installed the ACHeck21 PHP API

If you installed the API using Composer, you can add the API to your PHP source file using Composer's autoload

<?php 
require_once 'vendor/autoload.php';

If you manually installed it, you will need to require the path you downloaded it to as well as the path to Unirest.

<?php
// Only do this if you are NOT using Composer
require_once '/path/to/acheck21-php/acheck21.php'; require_once '/path/to/unirest-php/src/Unirest.php';

Before creating a check you will need to gather the required data. The minimum information needed to create a check is listed in the following table.

Username Your ACHeck21 Global Gateway login username
Password Your ACHeck21 Global Gateway login password
Client ID The ACHeck21 Global Gateway ID of the client who received the check
Transit Number The 9-digit ABA routing number of the check
DDA Number The account number of the check
Check Number The check number.
Account Type Checking or Savings
Check Amount The amount of the check
Entry Class Code The type of check. This determines how it's processed and other rules like whether or not a check image is required

To begin creating a check we will initialize the necessary data in our PHP code.

$username = "nobody@domain.com"; // this is not a real username
$password = "NotARealP@ssword"; // this is not a real password
$clientID = "00000000000"; // this is not a real client id
$transitNumber = "063100277";
$ddaNumber = "12345678912345"
$checkNumber = "0001";
$checkAmount = "1.00" // $1.00 check amount
$accountType = "Checking";
$entryClass = "WEB";

This example uses the WEB entry class because it does not require check images. After we have initialized the necessary data, we create a check with the followng code.

$checkID = ACHeck21::createCheck($username, 
$password,
$clientID, $checkNumber,
$transitNumber,
$ddaNumber, $accountType,
$checkAmount,
$entryClass);

If a check is successfully created, the function will return the new check's ID. If there was an unexpected error, it will return null. 

Creating a Check with Images

In the above example, we used the WEB entry class code because it didn't require images to create the check. Some entry classes, like C21(Check21), require images. 

When creating a check that requires images using the PHP API, the images need to meet the following requirements.

  • Both front and rear images must be sent.
  • The images must be in TIFF format. 

For example, if you had scanned and stored front and rear images of a check and stored it on a hard drive, you use them to create a check with the following code.

$checkID = ACHeck21::createCheck($username, 
$password,
$clientID, $checkNumber,
$transitNumber,
$ddaNumber, $accountType,
$checkAmount,
"C21" // C21 entry class
NULL,
NULL,
"frontImage.tiff" // front image file name
"rearImage.tiff" // rear image file name);

 

Have more questions? Submit a request

Comments