Giter VIP home page Giter VIP logo

avatax_sdk's Introduction

Avalara AvaTax Python SDK

Build Status

About Our Product:

This GitHub repository is the Python SDK for Avalara's world-class tax service, AvaTax. It uses the AvaTax REST v2 API, which is a fully REST implementation and provides a single client for all AvaTax functionality. For more information about AvaTax REST v2, please visit Avalara's Developer Network or view the online Swagger documentation.

Meet the Team:

Han Bao

Philip Werner

Robert Bronson

Adrienne Karnoski

Set Up and Installation:

Clone this repository to your local machine.

$ git clone https://github.com/avadev/AvaTax-REST-V2-Python-SDK.git

Once downloaded, cd into the AvaTax-REST-V2-Python-SDK directory.

$ cd AvaTax-REST-V2-Python-SDK

Begin a new virtual environment with Python 3 and activate it.

Python_Final $ python3 -m venv ENV
Python_Final $ source ENV/bin/activate

pip install this package as well as the testing set of extras into your virtual enviroment.

(ENV) Python_Final $ pip install -e .
(ENV) Python_Final $ pip install -e .[testing]

Usage:

Configuration

Environment

Avalara provides two different environments for AvaTax: Sandbox and Production.

The Sandbox environment is meant to help you test your software without the risk of accidentally affecting production data or reporting transactions.

In Production, transactions that are marked Committed can be reported on a tax filing using the Avalara Managed Returns Service.

Each environment is completely separate, and each has its own credentials.

If you have a Sandbox account, you cannot use that account to log onto Production; and vice versa.

Setup Test Credentials

For testing, your credentials are accessed as environment varibales through os.environ. Add the following to the activate file in your environment:

  bash
# Username and password
USERNAME='your_sandbox_username'
PASSWORD='your_sandbox_password'

# Or account id and license key
ACCOUNT_ID='your_sandbox_account_id'
LICENSE_KEY='your_sandbox_license_key'

Setting up environmental variables for production mode is similar:

export USERNAME='<your-username>'
export PASSWORD='<your-password>'
export ACCOUNT_ID='<your-account-id>'
export LICENSE_KEY='<your-license-key>'

Import the python AvaTaxClient from the client module:

from client import AvaTaxClient

Create a new AvaTaxClient object:

client = new AvaTaxClient("app-name", 'app-version', 'your-machine-name', 'your-desired-environment').add_credentials('<Your-credentials>')

Tax Calculation

tax_document = {
  type: 'SalesInvoice',
  companyCode: 'abc123',
  date: '2017-04-12',
  customerCode: 'ABC',
  purchaseOrderNo: '2017-04-12-001',
  addresses: {
    SingleLocation: {
      line1: '123 Main Street',
      city: 'Irvine',
      region: 'CA',
      country: 'US',
      postalCode: '92615'
    }
  },
  lines: [
    {
      number: '1',
      quantity: 1,
      amount: 100,
      taxCode: 'PS081282',
      itemCode: 'Y0001',
      description: 'Yarn'
    }
  ],
  commit: true,
  currencyCode: 'USD',
  description: 'Yarn'
}
return print(client.createTransaction(tax_document))

Address Validation

address = {
  city: 'irvine',
  postalCode: '92615',
  region: 'ca',
  country: 'us'
}
return print(client.resolveAddress(address))

avatax_sdk's People

Contributors

adriennekarnoski avatar han8909227 avatar philipwerner avatar rjb888 avatar ted-spence-avalara avatar

Watchers

 avatar  avatar

Forkers

akarnoski

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.