6.0.0 • Published 5 years ago
@datafire/vatapi v6.0.0
@datafire/vatapi
Client library for VAT API
Installation and Usage
npm install --save @datafire/vatapilet vatapi = require('@datafire/vatapi').create({
apikey: ""
});
.then(data => {
console.log(data);
});Description
A developer friendly API to help your business achieve VAT compliance
Actions
country_code_check
Retrieve a countries VAT rates by its 2 digit country code
vatapi.country_code_check({
"code": ""
}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML - code required
string: The 2 digit country code
- Response-Type
Output
- output Country_Code_Check
currency_conversion
Convert a currency
vatapi.currency_conversion({
"currency_from": "",
"currency_to": ""
}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML - currency_from required
string: The currency code you are converting from - currency_to required
string: The currency code you are converting to - amount
integer: Optional, an amount you are wanting to convert. Leave blank to just get the current rate
- Response-Type
Output
- output Currency_Conversion
create_invoice
Create a VAT invoice
vatapi.create_invoice({
"body": null
}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML - body required Invoice_Data
- Response-Type
Output
- output Create_Invoice
invoice_delete
Delete an invoice
vatapi.invoice_delete({
"id": 0
}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML - id required
integer: Enter an invoice id
- Response-Type
Output
Output schema unknown
get_invoice
Retrieve an invoice
vatapi.get_invoice({
"id": 0
}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML - id required
integer: Enter the invoice id
- Response-Type
Output
- output Retrieve_Invoice
invoice_update
Update an existing invoice
vatapi.invoice_update({
"id": 0,
"body": null
}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML - id required
integer: Enter an invoice id - body required Update_Invoice_Array
- Response-Type
Output
- output Update_Invoice
ip_check
Retrieve a countries VAT rates from an IP address
vatapi.ip_check({
"address": ""
}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML - address required
string: The IP address to search against
- Response-Type
Output
- output IP_Check
api_usage
Check api requests remaining on current subscription plan
vatapi.api_usage({}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML
- Response-Type
Output
- output Api_Usage
vat_number_validate
vatapi.vat_number_validate({
"vatid": ""
}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML - vatid required
string: The VAT number to validate
- Response-Type
Output
Output schema unknown
convert_price
Convert a price to or from VAT price.
vatapi.convert_price({
"code": "",
"price": 0
}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML - code required
string: The 2 digit country code - country_rate
string: The VAT rate to get the price for. Default: standard - price required
integer: The price you want converting - type
string: Optional, if the price is including VAT set the type to 'incl'. Otherwise the default is assumed as excluding VAT already, 'excl'
- Response-Type
Output
- output Convert_Price
vat_rates
Retrieve all current EU VAT rates
vatapi.vat_rates({}, context)Input
- input
object- Response-Type
string: The default response type is application/json if you would like to receive an XML response then set this to XML
- Response-Type
Output
- output Vat_Rates
Definitions
Api_Usage
- Api_Usage
object- requests_remaining required
integer: The number of api requests remaining in the current billing period - requests_used required
integer: The number of api requests consumed within the last 30 days - status required
integer: Response code
- requests_remaining required
Convert_Price
- Convert_Price
object- country_code required
string: The 2 digit country code - country_rate required
string: The country_rate - price_excl_vat required
integer: The price excluding VAT - price_incl_vat required
integer: The price including VAT - rate required
integer: The rate % for the country_rate - status required
integer: Response code - vat required
integer: The total amount of VAT applied
- country_code required
Country_Code_Check
- Country_Code_Check
object- country required
string: The country name - country_code required
string: The 2 digit country code - rates required Country_Rates
- status required
integer: Response code - vat_applies required
string: TRUE or FALSE, depending if country is within the EU.
- country required
Country_Data
- Country_Data
object- country required
string: The country name - rates required Country_Rates
- country required
Country_Rates
- Country_Rates
object- parking required parking
- reduced required reduced
- reduced_alt required reduced_alt
- standard required standard
- super_reduced required super_reduced
Create_Invoice
- Create_Invoice
object- invoice required Invoice_Array
- status required
integer: Response code
Currency_Conversion
- Currency_Conversion
object- amount_from
string: The amount you are converting from - amount_to
string: The result amount you have converted to - currency_from required
string: The currency code you are converting from - currency_to required
integer: The currency code you are converting to - rate required
string: The rate according to HMRC at time of sale - status required
integer: Response code
- amount_from
IP_Check
- IP_Check
object- country required
string: The country name - country_code required
string: The 2 digit country code - rates required Country_Rates
- status required
integer: Response code - vat_applies required
string: TRUE or FALSE, depending if country is within the EU.
- country required
Invoice_Array
- Invoice_Array
object- business_address required
string: Your business address - business_name required
string: Your business name - conversion_rate
integer: The rate of conversion at time of supply - currency_code required
string: 3 character currency code for invoice - currency_code_conversion
string: 3 character currency code to be converted from original transaction currency - customer_address
string: Your customers address - customer_name
string: Your customers name or trading name - customer_vat_number
string: Customers VAT number - date required
string: The date the invoice was issued - discount_rate
integer: The discount rate per item - discount_total required
integer: Total amount of discount - invoice_number required
integer: A sequential invoice number - invoice_url required
string: A perminant URL to your VAT invoice - items required
array: An array of your invoice items- items Invoice_Items
- logo_url
string: A URL to your logo image. Must be SSL hosted. https://sslimagehost.com is recommended - notes
string: Any notes attached to the invoice - subtotal required
integer: Total amount excluding VAT - tax_point required
string: (or 'time of supply') if this is different from the invoice date - total required
integer: Total amount of including VAT - type required
string: The type of invoice. Either 'sale' or 'refund' - vat_number required
string: Your VAT number - vat_total required
integer: Total amount of VAT
- business_address required
Invoice_Data
- Invoice_Data
object- business_address required
string: Your business address - business_name required
string: Your business name - conversion_rate
integer: The rate of conversion at time of supply - currency_code required
string: 3 character currency code for invoice - currency_code_conversion
string: 3 character currency code to be converted from original transaction currency - customer_address
string: Your customers address - customer_name
string: Your customers name or trading name - customer_vat_number
string: Optional customers VAT number - date
string: The date the invoice was issued - discount_rate
string: The discount rate per item - items required
array: An array of your invoice items- items Invoice_Items
- notes
string: Add a note to the invoice. - price_type
string: Optional, if the price is including VAT set the type to 'incl'. Otherwise the default is assumed as excluding VAT already, 'excl' - tax_point
string: (or 'time of supply') if this is different from the invoice date - type required
string: The type of invoice. Either 'sale' or 'refund' - vat_number required
string: Your VAT number - zero_rated
string: To Zero-Rate the VAT, set to true.
- business_address required
Invoice_Items
- Invoice_Items
object- description required
string: The item line description - price_each required
integer: The price of the individual item (Ex VAT) - quantity required
integer: The quantity of the item - vat_rate required
integer: The VAT rate at which the item is charged
- description required
Retrieve_Invoice
- Retrieve_Invoice
object- invoice required Retrieve_Invoice_Array
- status required
string: Response code
Retrieve_Invoice_Array
- Retrieve_Invoice_Array
object- business_address required
string: Your business address - business_name required
string: Your business name - conversion_rate
integer: The rate of conversion at time of supply - currency_code required
string: 3 character currency code for invoice - currency_code_conversion
string: 3 character currency code to be converted from original transaction currency - customer_address
string: Your customers address - customer_name
string: Your customers name or trading name - customer_vat_number
string: Optional, customers VAT number - date required
string: The date the invoice was issued - discount_rate
integer: The discount rate per item - discount_total required
integer: Total amount of discount - id required
integer: The invoice ID - invoice_url required
string: A perminant URL to your VAT invoice - items required
array: An array of your invoice items- items Invoice_Items
- logo_url
string: A URL to your logo image. Must be SSL hosted. https://sslimagehost.com is recommended - notes
string: Any notes attached to the invoice - price_type
string: Optional, if the price is including VAT set the type to 'incl'. Otherwise the default is assumed as excluding VAT already, 'excl' - subtotal required
integer: Total amount excluding VAT - tax_point required
string: (or 'time of supply') if this is different from the invoice date - total required
integer: Total amount of including VAT - type required
string: The type of invoice. Either 'sale' or 'refund' - vat_number required
string: Your VAT number - vat_total required
integer: Total amount of VAT - zero_rated
string: To Zero-Rate the VAT, set to true.
- business_address required
Update_Invoice
- Update_Invoice
object- invoice required Retrieve_Invoice_Array
- status required
string: Response code
Update_Invoice_Array
- Update_Invoice_Array
object- business_address required
string: Your business address - business_name required
string: Your business name - conversion_rate
integer: The rate of conversion at time of supply - currency_code required
string: 3 character currency code for invoice - currency_code_conversion
string: 3 character currency code to be converted from original transaction currency - customer_address
string: Your customers address - customer_name
string: Your customers name or trading name - customervat_number required
string: Customers VAT number - date
string: The date the invoice was issued - discount_rate
string: The discount rate per item - items required
array: An array of your invoice items- items Invoice_Items
- logo_url
string: A URL to your logo image. Must be SSL hosted. https://sslimagehost.com is recommended - notes
string: Add a note to the invoice. - tax_point
string: (or 'time of supply') if this is different from the invoice date - type required
string: The type of invoice. Either 'sale' or 'refund' - vat_number
string: Your VAT number
- business_address required
Vat_Rates
- Vat_Rates
object- countries required
array: An array of the EU VAT countries and their respective rates- items Vat_Rates_Countries
- status required
integer: Response code
- countries required
Vat_Rates_Countries
- Vat_Rates_Countries
object- country_code required Country_Data
parking
- parking
object- applies_to required
string: The type of goods the rate applies to - value required
integer: The % VAT rate
- applies_to required
reduced
- reduced
object- applies_to required
string: The type of goods the rate applies to - value required
integer: The % VAT rate
- applies_to required
reduced_alt
- reduced_alt
object- applies_to required
string: The type of goods the rate applies to - value required
integer: The % VAT rate
- applies_to required
standard
- standard
object- value required
integer: The % VAT rate
- value required
super_reduced
- super_reduced
object- applies_to required
string: The type of goods the rate applies to - value required
integer: The % VAT rate
- applies_to required