Transaction validation

The API has a method for performing validation on a transaction before you submit it for processing. This is useful for fraud prevention. The validation involves running the account and name of the other party in your transaction through various databases looking for unpaid items (i.e. bounced checks) and other triggers that would warrant concern.

Setting validate options

var validateCheckParams = {
  "accountNumber": "123456787",
  "amount": 12.34,
  "checkNumber": "1001",
  "individualName": "Nobody J. Smith",
  "routingNumber": "021000021"
}
ValidateCheckParams params = new ValidateCheckParams();
params.setAccountNumber("11101013");
params.setCheckNumber("1001");
params.setRoutingNumber("061103852");
params.setAmount(new BigDecimal(100));
params.setIndividualName("Nobody J. Smith");
ACHValidateCheckParams* values = [[ACHValidateCheckParams alloc] init];
[values setCheckNumber: [@(checkNum) stringValue]];
[values setAmount:@100.0];
[values setRoutingNumber:@"061103852"];
[values setAccountNumber:@"11101013"];
[values setIndividualName:@"Nobody J. Smith"];
var validation = new ValidateCheckParams()
{
  AccountNumber = "11101013",
  CheckNumber = "1001",
  RoutingNumber = "061103852",
  Amount = 100m,
  IndividualName = "Nobody J. Smith"
};

Performing validation

// direct REST call from Javascript
var username= "[email protected]",
    password = "notArealpassw0rd";

var settings = {
  "async": true,
  "url": "https://gateway.acheck21.com/GlobalGateway/api/v1/checks/default/validate",
  "method": "POST",
  "headers": {
    	// this header needs to be set on every REST call.
   		"Authorization": "Basic " + btoa(username + ":" + password)
  },
  "processData": false,
  "data" : JSON.stringify(validateCheckParams),
  "contentType" : "application/json"
}

$.ajax(settings).done(function (data) {
	if (data.Response == "Authorized"){
  	// transaction validated.
  }
  else{
  	console.log(data.detailLines);
  }
});
ChecksApi apiInstance = new ChecksApi();
ValidationResult response = apiInstance.validateCheck("default", params);
if (response.getResult() == ValidationResponseType.AUTHORIZED)
{
	System.out.println("Good transaction");
}
[apiInstance validateCheckWithClientId:@"default"
                                    values:values
 completionHandler: ^(ACHValidationResult* output, NSError* error) {
   if (output) {
     if ([[output result] isEqualToString:@"Accepted"]){
       NSLog(@"Good transaction");
     }
     else{
       NSLog(@"Bad transaction");
     }
   }
   if (error) {
     NSLog(@"Error calling ACHChecksApi->validateCheck: %@", error);
   }
 }];
Client client = new Client("https://gateway.acheck21.com/GlobalGateway");
var result = client.ValidateCheckAsync(config.clientid, validation).Result;

The response will looks something like this.

{
  "result": "Authorized",
  "detailLines": [
    "string"
  ]
}