Validating Tax Documentation
Before calling the collect or certify functions, you can pre-validate your tax documentation data. This validation ensures your data is correct before sending it to the API or exposing it to your customers.
Example input
taxBit.taxDocumentation.validate({
documentType: "W9"
name: "Anthony Michael Pearson",
address: {
firstLine: "123 Lenny St.",
secondLine: "Apt 204",
city: "Seattle",
stateOrProvince: "WA",
postalCode: "98101",
country: "US",
},
taxClassification: "INDIVIDUAL"
});
In the example input above, the documentType
value is invalid. This would cause the method to throw an error. The error object contains an issues
field that provides more information about what went wrong. Here is an example of the issues
list:
{
issues: [ { path: [ 'document_type' ], message: 'Invalid' } ]
}
Updated over 1 year ago