Related Topics

"Your online store and account control is priceless as we can make changes instantly!"

read more >>

Home > Services

VAT Number Verifier

The VAT Number Verifier (VNV) is a cgi that call be called with a ISO country code and a VAT number to both verify the VAT number is correct and return the VAT rate as a percentage for the matching country code. It will also determine if state tax will be charged.

Syntax:

http://usd.swreg.org/cgi-bin/vnv.cgi?mode=<mode>&country=<ISO country code>&state=<state code>&number=<number>&city=<city>&zip=<zip>

  • country must be a valid ISO country code (valid ISO codes can be found on the customer details page of the intermediate level checkout process)
  • state must be the state code/province code/county code (if entered)
  • number must be the VAT number entered (if any).
  • city must be the ship to city for the order (if any).
  • zip must be the ship to zip code for the order (if any, but required for US & CA).

Mode

The mode parameter affects the format of the output. This parameter can be one of the following values.

  • plain
  • html
  • sparse
  • sparse-html

Plain Mode

In plain mode, the module will return the percentage rate, or 0 with 2 lines of errors separated by return characters. This will be prefixed with a content type line.

Eg. vnv.cgi?mode=plain&country=GB&number=GB123456789

will return ([cr] indicate a carriage return character)..

Content-Type: text/html[CR][CR]
17.5%[cr]

If an error occurrs...

Eg. vnv.cgi?mode=plain&country=GB&number=GB1xxx789

will return ..

Content-Type: text/html[CR][CR]
0%[CR]
4[CR]
Invalid VAT number

See the Errors section below for a list of all possible errors.

HTML Mode

HTML mode is similar to plain mode, however a full basic html page is output with the result encluded between <PRE> tags.

Sparse Mode

Sparse mode is similar to plain mode, however only the full VAT rate or 0% will be output (for both an error condition or countries that do not have VAT).

Sparse HTML Mode

Sparse HTML mode is similar to Sparse mode, however the output is placed in a full HTML page similar to the normal HTML mode.

Error Conditions

If a European country is passed in with a valid VAT number, then the VAT rate will be output othwise it will be treated as an error condition and a rate of 0% will be output. In HTML/Plain mode 3 lines of data will be output

<rate>[CR]
<error_number>[CR]
<textual error message>[CR]

The following are a list of supported error messages. Any error code 10 or greater is a fatal error.

  • 0 - Valid EU country, Valid VAT number - VAT rate will always be 0%.
  • 1 - Valid EU country, Invalid VAT number - VAT rate will always be the local rate for the supplied ISO country code.
  • 2 - Non-EU country - VAT rate will always be 0%.
  • 3 - United States, State TAX - tax rate will returned or 0 will be returned.
  • 10 - Missing parameter : country - Must be supplied, must be a valid ISO country code.
  • 11 - Missing parameter : number - Must be supplied, can be empty.
  • 12 - Missing parameter : state - Must be supply state code, can be empty.
  • 13 - Invalid Mode - Must be one of the above modes.
  • 14 - Invalid ISO Country code - Must be a valid ISO country code.