Validating Tax Documentation

🚧

This page is marked as deprecated, but Taxbit will continue supporting customers currently using these solutions. If you’d like to learn more about upgrading to our new React SDK with enhanced Digital W8/W9 support, reach out to our team today.

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' } ]
}