2017 © Pedro Peláez
 

library avalara-tax-rates-api

image

brookside/avalara-tax-rates-api

  • Saturday, March 31, 2018
  • by cornell
  • Repository
  • 1 Watchers
  • 0 Stars
  • 209 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 32 % Grown

The README.md

Avalara Tax Rates API Wrapper

A simple PHP wrapper for Avalara’s free sales tax rates API., (*1)

AvaTax Developer Account Requirements

You will need to have signed up for an Avalara developer account and API key. More information can be found at developer.avalara.com/avatax/signup., (*2)

As of June 15, 2017, Avalara has retired the free tax rates API that this api was based on. In order to use (or continue using) this API, you will need to signup for a free trial account which will give you continued access to the free tax rates API., (*3)

More details from Avalara:, (*4)

“The trial provides 30 days of full AvaTax product functionality in our Sandbox (testing) environment. This includes continuing support for API access to tax rates. After 30 days, the product trial functionality will be limited to the free tax rates API functionality only.”, (*5)

Install

Using Composer:, (*6)

composer require brookside/avalara-tax-rates-api:dev-master

or just require the TaxRates.php file:, (*7)

require 'path/to/TaxRates.php';

Usage

use Brookside\TaxRates\TaxRates;

$tr = new TaxRates([
    'username' => 'YOUR_AVALARA_USERNAME',
    'password' => 'YOUR_AVALARA_PASSWORD',
]);

Rates can be retrieved from just a postal code:, (*8)

$rates = $tr->getRates(74114);

For more accurate rates, you can pass as much address information as you have. All available fields are used below:, (*9)

$rates = $tr->getRates(array(
    'street'  => '4145 E. 21st St',
    'city'    => 'Tulsa',
    'state'   => 'OK',
    'country' => 'USA',
    'postal'  => 74114,
));

Results

Results will vary depending on location, but you will always be returned with an array with two keys: totalRate and rates. The rates key will contain up to three rates – for city, state, and county., (*10)

Example result:, (*11)

Note that the new API does not include the actual State, County, or City names like the old API did., (*12)

Array
(
    [totalRate] => 8.517
    [rates] => Array
        (
            [0] => Array
                (
                    [rate] => 4.5
                    [name] => OK STATE TAX
                    [type] => State
                )

            [1] => Array
                (
                    [rate] => 0.367
                    [name] => OK COUNTY TAX
                    [type] => County
                )

            [2] => Array
                (
                    [rate] => 3.65
                    [name] => OK CITY TAX
                    [type] => City
                )

        )

)

The Versions

31/03 2018

1.0.1

1.0.1.0

  Sources   Download

15/06 2017

dev-master

9999999-dev https://github.com/brooksidestudios/avalara-tax-rates-api

Simple PHP wrapper for Avalara's Tax Rates API

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

by Cornell Campbell

tax avalara avatax tax-rates

15/06 2017

1.1.0

1.1.0.0 https://github.com/brooksidestudios/avalara-tax-rates-api

Simple PHP wrapper for Avalara's Tax Rates API

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

by Cornell Campbell

tax avalara avatax tax-rates