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
ο»Ώ
βxvar validateCheckParams = {
"accountNumber": "123456787",
"amount": 12.34,
"checkNumber": "1001",
"individualName": "Nobody J. Smith",
"routingNumber": "021000021"
}
## Performing validation
ο»Ώ
xxxxxxxxxx
125// direct REST call from Javascript
var username= "nobody@fakedomain.com",
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);
}
});
The response will looks something like this.
ο»Ώ
xxxxxxxxxx
1{
"result": "Authorized",
"detailLines": [
"string"
]
}
ο»Ώ