承接 brookside/avalara-tax-rates-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

brookside/avalara-tax-rates-api

Composer 安装命令:

composer require brookside/avalara-tax-rates-api

包简介

Simple PHP wrapper for Avalara's Tax Rates API

README 文档

README

A simple PHP wrapper for Avalara’s free sales tax rates API.

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.

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.

More details from Avalara:

“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.”

Install

Using Composer:

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

or just require the TaxRates.php file:

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:

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

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

$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.

Example result:

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

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
                )

        )

)

统计信息

  • 总下载量: 966
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固