SDKs overview

The Tax Data API offers a suite of Software Development Kits (SDKs) and client libraries designed to simplify the integration of its tax calculation and data services into various applications. These SDKs abstract away the complexities of direct HTTP requests, authentication, and JSON parsing, allowing developers to interact with the API using native language constructs. The primary goal of these libraries is to accelerate development cycles for tasks such as sales tax calculation, VAT determination, GST application, and jurisdiction-specific tax rate lookups, which are critical for e-commerce platforms and financial software.

Each official SDK is maintained to reflect the latest API versions and best practices, ensuring compatibility and access to new features as they are released. Developers can utilize these SDKs to implement functionalities like calculating taxes for transactions, retrieving tax rates for specific locations, or identifying the correct tax jurisdiction based on an address. The SDKs typically include classes and methods that map directly to API endpoints, making it intuitive to call services like the Sales Tax API, VAT API, or Jurisdiction Lookup API.

Beyond the official offerings, a developer ecosystem may also contribute community-driven libraries. These can provide alternative implementations, specialized functionalities, or support for languages not officially covered. However, official SDKs generally provide the most reliable and up-to-date integration paths, supported directly by the Tax Data API team for consistency with the API reference documentation.

Official SDKs by language

Tax Data API provides official SDKs for several popular programming languages, facilitating integration across different development environments. These SDKs are maintained by the Tax Data API team and are the recommended method for interacting with the API.

Language Package Name / Repository Install Command Example Maturity Level
Python taxdata-python pip install taxdata-python Stable
Node.js @taxdata/node npm install @taxdata/node Stable
Ruby taxdata-ruby gem install taxdata-ruby Stable
PHP taxdata/php-sdk composer require taxdata/php-sdk Stable
Java com.taxdata:java-sdk Add to pom.xml (Maven) or build.gradle (Gradle) Stable
Go github.com/taxdata/go-sdk go get github.com/taxdata/go-sdk Stable

Each SDK provides idiomatic interfaces for its respective language, adhering to common coding conventions and practices. For example, the Python SDK might use snake_case for method names, while the Java SDK would use camelCase, reflecting standard library conventions. This design choice aims to make the integration feel natural for developers experienced in each language, reducing the learning curve associated with a new API. Developers can find detailed API-specific usage instructions and examples within the official developer documentation.

Installation

Installing the Tax Data API SDKs typically involves using the standard package manager for each programming language. Below are specific instructions for the officially supported SDKs.

Python

The Python SDK is distributed via PyPI. You can install it using pip:

pip install taxdata-python

It is recommended to install SDKs within a virtual environment to manage dependencies effectively. Python's venv module can create isolated environments, preventing conflicts with global packages. For example, python3 -m venv .venv && source .venv/bin/activate would set up and activate a new virtual environment.

Node.js

The Node.js SDK is available on npm:

npm install @taxdata/node

Alternatively, if you prefer Yarn for package management:

yarn add @taxdata/node

Node.js projects often use package.json to declare dependencies, which npm or yarn manage automatically. This ensures consistent environments across development, testing, and production deployments.

Ruby

The Ruby SDK is available as a Gem:

gem install taxdata-ruby

For Ruby projects, adding gem 'taxdata-ruby' to your Gemfile and then running bundle install is the standard practice within a Bundler-managed application.

PHP

The PHP SDK uses Composer for dependency management:

composer require taxdata/php-sdk

Composer will download the necessary files and set up an autoloader, making the SDK classes available in your PHP application. Ensure Composer is installed on your system by following the Composer installation guide.

Java

For Java applications, the SDK is available through Maven Central. You'll need to add the dependency to your project's pom.xml (for Maven) or build.gradle (for Gradle).

Maven (pom.xml)

<dependency>
    <groupId>com.taxdata</groupId>
    <artifactId>java-sdk</artifactId>
    <version>1.0.0</version> <!-- Use the latest version -->
</dependency>

Gradle (build.gradle)

implementation 'com.taxdata:java-sdk:1.0.0' // Use the latest version

The version number should be updated to the latest release, which can be found in the Tax Data API documentation or Maven Central repository.

Go

The Go SDK can be installed using the go get command:

go get github.com/taxdata/go-sdk

After running this command, the SDK will be downloaded and added to your Go module dependencies. Go modules provide robust dependency management, ensuring reproducibility across builds.

Quickstart example

This example demonstrates how to calculate sales tax for a fictional purchase using the Tax Data API's Python SDK. This snippet assumes you have installed the taxdata-python package and have your API key ready. The API key is essential for authenticating your requests, similar to how Stripe API keys secure payment processing requests.

import os
from taxdata_python import TaxDataClient
from taxdata_python.models import TransactionItem, Address, TaxCalculationRequest

# Initialize the client with your API key
# It's recommended to store your API key in an environment variable
api_key = os.environ.get("TAXDATA_API_KEY")
if not api_key:
    raise ValueError("TAXDATA_API_KEY environment variable not set.")

client = TaxDataClient(api_key=api_key)

# Define the transaction items
items = [
    TransactionItem(
        product_code="SKU001",
        description="Laptop",
        unit_price=1200.00,
        quantity=1
    ),
    TransactionItem(
        product_code="SKU002",
        description="Mouse",
        unit_price=25.00,
        quantity=2
    )
]

# Define the shipping/destination address
destination_address = Address(
    street="123 Main St",
    city="Anytown",
    state="CA",
    zip_code="90210",
    country="US"
)

# Create the tax calculation request
request = TaxCalculationRequest(
    items=items,
    destination_address=destination_address,
    currency="USD",
    customer_id="CUST123"
)

try:
    # Perform the tax calculation
    response = client.calculate_tax(request)

    # Print the results
    print(f"Total Tax: {response.total_tax_amount} {response.currency}")
    for line_item_tax in response.line_items_tax:
        print(f"  Item '{line_item_tax.description}': {line_item_tax.tax_amount} {response.currency}")
    print(f"Jurisdictions applied: {', '.join([j.name for j in response.jurisdictions])}")

except Exception as e:
    print(f"An error occurred: {e}")

This example demonstrates a basic tax calculation for a simple transaction. The TaxDataClient is initialized with an API key, which authenticates the request. A TaxCalculationRequest object is then constructed with transaction details like items, quantities, prices, and the destination address. The SDK handles serializing this object into a JSON payload and sending it to the Tax Data API endpoint. The response, containing the total tax and detailed line item taxes, is then deserialized back into a Python object for easy access.

For more complex scenarios, such as handling exemptions, adjusting for shipping costs, or applying specific tax codes, the SDK provides additional parameters and methods. Developers should consult the Tax Data API reference documentation for a comprehensive list of available fields and their usage.

Community libraries

While Tax Data API provides a robust set of official SDKs, the broader developer community may also contribute open-source libraries or wrappers. These community-driven projects can sometimes offer specialized features, alternative API patterns, or support for languages not covered by official SDKs.

Community libraries are typically found on platforms like GitHub, npm, or PyPI. Developers interested in using such libraries should evaluate their maintenance status, community support, and compatibility with the latest Tax Data API versions. Factors to consider include:

  • Active Maintenance: Is the library regularly updated to address bugs and incorporate new API features?
  • Documentation: Is there clear and comprehensive documentation for installation and usage?
  • Testing: Does the library have a good test suite to ensure reliability?
  • Community Support: Is there an active community (e.g., GitHub issues, forums) to assist with questions or problems?

While official SDKs are generally recommended for their direct support and guaranteed compatibility, community contributions can sometimes offer valuable extensions or niche solutions. For instance, a community library might provide a framework-specific integration (e.g., a Django or Rails plugin) that simplifies common tasks within that framework. However, developers should always refer to the official Tax Data API developer hub to confirm any specific recommendations or guidelines regarding third-party integrations.

Developers contributing to or using community libraries play a vital role in extending the ecosystem. They often provide valuable feedback and innovative solutions that can benefit the wider user base. When evaluating any unofficial library, it's prudent to check its licensing terms and ensure it aligns with your project's requirements. For example, understanding open-source licenses like MIT or Apache 2.0, as detailed by the Apache Software Foundation, is crucial for compliance.