EU VAT Validation via SuiteScript

Yesterday, I saw a post on NetSuite Professionals Slack community about a service to validate EU VAT Numbers. It was mentioned that a service called VIES on European Commission website can be used for this purpose. Service can be used via UI or through SOAP request as well.

Reviewing the information and usage of the service, I wanted to build a function that can be used in SuiteScript that will send a SOAP request and return the response as a JSON object. This was also an opportunity for me to use the N/xml module for the first time.

Going into coding, I developed getEuVatCodeDetails function that sends SOAP request and processes the response returned. I did not added more logic to work with the response but it can rather be done outside of the function based on the requirements. Right now, I don’t know if I will use it in the future, or not.

It maybe good idea to add a Entity Custom Field and build a User Event Script to store the response from this service for review. For testing, I created a simple Suitelet that accepts the Country Code and VAT Number from user and returns response. Source code is available on our GitHub page. If you are planning to add this to your project, please review the WSDL file for the error codes that may be returned.

We would like to hear your opinion if you liked this solution or if you discover something missing, something not working properly, a better option, weird coding. If you have any comments on this solution, please use the section below. For any other communication, please use the form on the Contact Us page.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.