Skip to content

Vapor wrapper for verifying VAT-numbers via the VIES service.

License

Notifications You must be signed in to change notification settings

vapor-community/vatifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vatifier

Swift Vapor

Vatifier is a Vapor helper for verifying VAT numbers via the VIES service

Usage

Add the following line to your Package.swift

.package(url: "https://github.com/vapor-community/vatifier.git", from: "1.0.0")

.product(name: "Vatifier", package: "vatifier")

Add this line to your configure.swift file:

import Vatifier

app.vatifier.use(.VIES)

You can now verify VAT numbers from Application or Request

app.vatifier.verify("47458714", country: "DK")
req.vatifier.verify("47458714", country: "DK")

If the API request was successfull you will have a VATVerificationResponse which contains an isValid boolean and optional name and address properties. If the API request failed, the future will be in an error state and a VIESError will be returned.