Using the Loqate Address Verification service, is there a way to programatically detect that your account is out of credit, on load of the control? Something like the code below (that I just made up)?
var controlToReturn = new pca.Address(fields, avOptions);
control.listen("load", function () {
if (this.accountCredit == 0) {
//do stuff
}
});
It's possible to handle a zero credit error thrown by the control after you've used it, but at that point you've displayed an address search field, and then have to hide it, and fall back to a standard address form layout (in our case at least).
controlToReturn.listen("error", function (message) {
console.error(message);
const ERROR_MESSAGE_ZERO_CREDIT = "Account out of credit";
if (message != ERROR_MESSAGE_ZERO_CREDIT)
alert("Error with address checker service: " + message);
}
There doesn't seem to be anything in their docs, but I just wondered if anyone knew of any properties on the control / other API calls that would allow this?