tags:

views:

67

answers:

1

Hello!

I'm writing a small app with different inputs from a file (like countrycode, vat number etc) and I have to validate that the vat numbers are in the correct format.

I've tried this one: http://www.codeproject.com/KB/cs/VATchecker.aspx - and it works.. but, and yes, there's always a but :-), I have to check anywhere from 100 - 500 vat numbers and it's just too slow for that. Besides, I'm not sure they appreciate me hammering their site like that.

Does anyone know of an offline vat-validater I can build into my C# program?

Thanks in advance! Thomas

A: 

If you look at this site they do specify the structure of the VAT numbers for each of the member states. Possibly you could do a check for your numbers being in the correct structure first which might avoid having to do some of the requests.

Other than that, I think you will have to use this webservice to validate the numbers. The webservice does not link to a single database but rather connect to each state's database to verify the number, so there's no single database that you could download (maybe some states will have downloads of all valid VAT numbers that you could download, but I doubt it and you'd have to make sure that it's kept up to date etc).

As Steven suggests in his comment though, you might be able to speed it up by doing multiple requests at the same time. I wouldn't have thought that this would be a problem but you could always email the address mentioned in Q16 on that page and ask them if that is ok.

ho1
Yeah, I was looking at that one. I would probably have to make a function to check each VAT-number against the format, based on the country-code.Unfortunately I don't think looking up hundreds of VAT-numbers on their web-site is the best way to go. Would be much easier for me, but I guess I have to do it the hard way and check them manually to see if the format is correct :(
Thomas
@Thomas: Well, depends on why you're doing this check. If you're going to sell something VATable and you don't charge VAT because the client gave you a VAT number, and then that VAT number was invalid, I think you could end up having to pay VAT that you never collected, so in that instance it might be worth using the webservice to check as carefully as possible.
ho1
@ho1That is true. I forgot to write, that the input-variables come from our Navision, so the VAT-numbers _should_ be valid. The problem is we have quite a few "placeholder"-entries in our Navision-databases, that are empty or have "NO VAT".These are really the entries I need to check for. Our accounting-department check the VAT-numbers manually when they create customers. I know this might sound a bit confusing, but basically I was just wondering if anyone had writting a function that could validate the format of VAT-numbers, according to Q16 on VIES :)
Thomas