VAT_Checker_API

Handles calls to the VIES VAT API to fetch company VAT information.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Table of Contents

API_URL  = 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'
API URL - must be http as VIES doesn't work over https! (Seems it's now supported)
HMRC_URL  = 'https://api.service.hmrc.gov.uk/organisations/vat/check-vat-number/lookup'
HMRC API URL
check_vat()  : VAT_Check_Result
Check a VAT number against the supplied country code.
get_requester_country_code()  : string
Get the store's VAT country code.
get_requester_vat_number()  : string
Get the store's VAT number without the country code.
hmrc_request()  : VAT_Check_Result
Makes a request to the HMRC API
vies_request()  : VAT_Check_Result
Makes a request to the VIES API

Constants

API_URL

API URL - must be http as VIES doesn't work over https! (Seems it's now supported)

public mixed API_URL = 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'

HMRC_URL

HMRC API URL

public mixed HMRC_URL = 'https://api.service.hmrc.gov.uk/organisations/vat/check-vat-number/lookup'

Methods

check_vat()

Check a VAT number against the supplied country code.

public static check_vat(string $vat_number, string $country_code) : VAT_Check_Result
Parameters
$vat_number : string

The VAT number to check.

$country_code : string

The country code.

Return values
VAT_Check_Result

get_requester_country_code()

Get the store's VAT country code.

private static get_requester_country_code() : string
Return values
string

get_requester_vat_number()

Get the store's VAT number without the country code.

private static get_requester_vat_number() : string
Return values
string

vies_request()

Makes a request to the VIES API

private static vies_request(VAT_Check_Result $result, string $vat_number, string $country_code, string $vat_prefix_for_country[, mixed $bypass = false ]) : VAT_Check_Result
Parameters
$result : VAT_Check_Result
$vat_number : string
$country_code : string
$vat_prefix_for_country : string
$bypass : mixed = false
Return values
VAT_Check_Result

Search results