Live Support Agent

Tutorial: Create a Check with ACHeck21 Java API

Ryan Ackley -

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

Once you have the Java API installed, you need to import the main ACHeck21 API class at the top of the file you plan on using it from

 import com.acheck21.java.ACHeck21;

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 Java code.

String username = "nobody@domain.com"; // this is not a real username
String password = "NotARealP@ssword"; // this is not a real password
String clientID = "00000000000"; // this is not a real client id
String transitNumber = "063100277";
String ddaNumber = "12345678912345"
String checkNumber = "0001";
String checkAmount = "1.00" // $1.00 check amount
ACHeck21.AccountType accountType = ACHeck21.AccountType.Checking;
ACHeck21.EntryClass entryClass = ACHeck21.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.

  String checkID = ACHeck21.createCheck(username, 
                                        password, 
                                        clientID, 
                                        null,
                                        null, 
                                        checkNumber, 
                                        transitNumber, 
                                        ddaNumber, 
                                        accountType, 
                                        checkAmount, 
                                        entryClass, 
                                        null,
                                        null, 
                                        null, 
                                        null, 
                                        null);

If a check was successfully created, the createCheck function will return a valid check ID. If there was an unexpected error, an exception will be thrown or the function 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 Java 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 would prepare them with the following code. 

// Create an input stream for each image
InputStream frontStream = new FileInputStream("frontImage.tiff");
InputStream rearStream = new FileInputStream("rearImage.tiff");

You can then use these input streams in the createCheck function call.

 String checkID = ACHeck21.createCheck(username, 
                                        password, 
                                        clientID, 
                                        null,
                                        null, 
                                        checkNumber, 
                                        transitNumber, 
                                        ddaNumber, 
                                        accountType, 
                                        checkAmount, 
                                        ACHeck21.EntryClass.C21, //C21 entry class
                                        frontStream, // front image
                                        rearStream, // rear image
                                        null, 
                                        null, 
                                        null);
 

 

 

Have more questions? Submit a request

Comments