{"id":19608613,"url":"https://github.com/teamwork/vat","last_synced_at":"2026-04-14T09:02:59.838Z","repository":{"id":57513072,"uuid":"64693216","full_name":"Teamwork/vat","owner":"Teamwork","description":"VAT matching and validation in Go","archived":false,"fork":false,"pushed_at":"2025-04-15T10:26:57.000Z","size":42,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-15T11:28:00.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Teamwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-08-01T18:53:43.000Z","updated_at":"2025-04-15T10:26:15.000Z","dependencies_parsed_at":"2024-01-16T17:14:48.979Z","dependency_job_id":"a754d788-f871-4db9-b57d-dd44e2588a83","html_url":"https://github.com/Teamwork/vat","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fvat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fvat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fvat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teamwork%2Fvat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Teamwork","download_url":"https://codeload.github.com/Teamwork/vat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251204691,"owners_count":21552267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T10:15:56.916Z","updated_at":"2026-02-24T12:06:09.676Z","avatar_url":"https://github.com/Teamwork.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Package vat\n===\n\n![Build](https://github.com/Teamwork/vat/actions/workflows/build.yml/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/teamwork/vat/v3)](https://goreportcard.com/report/github.com/teamwork/vat/v3)\n[![GoDoc](https://godoc.org/github.com/teamwork/vat/v3?status.svg)](https://godoc.org/github.com/teamwork/vat/v3)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/teamwork/vat/master/LICENSE)\n\nPackage for validating VAT numbers \u0026 retrieving VAT rates (\nfrom [ibericode/vat-rates](https://github.com/ibericode/vat-rates)) in Go.\n\nBased on https://github.com/dannyvankooten/vat\n\n## Installation\n\nUse go get.\n\n``` \ngo get github.com/teamwork/vat\n```\n\nThen import the package into your own code.\n\n```\nimport \"github.com/teamwork/vat\"\n```\n\n## Usage\n\n### Validating VAT numbers\n\nVAT numbers can be validated by format, existence or both.\n\nEU VAT numbers are looked up using the [VIES VAT validation API](http://ec.europa.eu/taxation_customs/vies/).\n\nUK VAT numbers are looked up\nusing [UK GOV VAT validation API](https://developer.service.hmrc.gov.uk/api-documentation/docs/api/service/vat-registered-companies-api/1.0)\n(requires [signing up for the UK API](#accessing-the-uk-vat-api)).\n\n```go\npackage main\n\nimport \"github.com/teamwork/vat\"\n\nfunc main() {\n\t// These validation functions return an error if the VAT number is invalid. If no error, then it is valid.\n\n\t// Validate number by format + existence\n\terr := vat.Validate(\"NL123456789B01\")\n\n\t// Validate number format\n\terr := vat.ValidateFormat(\"NL123456789B01\")\n\n\t// Validate number existence\n\terr := vat.ValidateExists(\"NL123456789B01\")\n}\n```\n\n### Retrieving VAT rates\n\n\u003e This package relies on a [community maintained repository of vat rates](https://github.com/ibericode/vat-rates). We\n\u003e invite you to toggle notifications for that repository and contribute changes to VAT rates in your country once they\n\u003e are announced.\n\nTo get VAT rate periods for a country, first get a CountryRates struct using the country's ISO-3166-1-alpha2 code.\n\nYou can get the rate that is currently in effect using the `GetRate` function.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/teamwork/vat\"\n)\n\nfunc main() {\n\tc, err := vat.GetCountryRates(\"IE\")\n\tr, err := c.GetRate(\"standard\")\n\n\tfmt.Printf(\"Standard VAT rate for IE is %.2f\", r)\n\t// Output: Standard VAT rate for IE is 23.00\n}\n```\n\n# Accessing the UK VAT API\n\nFor validating VAT numbers that begin with \"GB\" you will need\nto [sign up to gain access to the UK government's VAT API](https://developer.service.hmrc.gov.uk/api-documentation/docs/using-the-hub).\n\nOnce you have signed up and acquire a client ID and client secret, here's how to generate and use an access token:\n\n```go\npackage main\n\nimport \"github.com/teamwork/vat\"\n\nfunc main() {\n\tvar ukAccessToken *vat.UKAccessToken\n\tukAccessToken, err := vat.GenerateUKAccessToken(vat.ValidatorOpts{\n\t\tUKClientID:     \"yourClientID\",\n\t\tUKClientSecret: \"yourClientSecret\",\n\t\tIsUKTest:       true, // set this if you are testing this in their sandbox test API\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// Recommended to cache the access token until it expires\n\n\terr := vat.Validate(\"GB123456789\", vat.ValidatorOpts{\n\t\tUKAccessToken: ukAccessToken.Token,\n\t\tIsUKTest:      true, // if token created in test mode, run validation in test mode\n\t})\n}\n\n```\n\n## License\n\nMIT licensed. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamwork%2Fvat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteamwork%2Fvat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteamwork%2Fvat/lists"}