AvaTax v2 SDK for languages using the Dot Net Framework
Switch branches/tags
Clone or download
Latest commit 6d848e2 Dec 4, 2018



This GitHub repository is the DotNet (or C#) 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.

Build Status





Installing the DotNet SDK

The AvaTax DotNet SDK is available on NuGet:

  • Right click on a project and select Manage NuGet Packages
  • Search for Avalara.AvaTax
  • Click Install to add the latest version

A detailed walkthrough is available on the Avalara Developer Blog:

Using the DotNet SDK

The DotNet SDK uses a fluent interface to define a connection to AvaTax and to make API calls to calculate tax on transactions. Here's an example of how to connect to AvaTax in C#:

using Avalara.AvaTax.RestClient;

public class Program
    public void Main()
        // Create a client and set up authentication
        var Client = new AvaTaxClient("MyTestApp", "1.0", Environment.MachineName, AvaTaxEnvironment.Sandbox)
            .WithSecurity("MyUsername", "MyPassword");

        // Verify that we can ping successfully
        var pingResult = Client.Ping();
        if (pingResult.authenticated) {

        // Create a simple transaction for $100 using the fluent transaction builder
        var transaction = new TransactionBuilder(Client, "DEFAULT", DocumentType.SalesInvoice, "ABC")
            .WithAddress(TransactionAddressType.SingleLocation, "123 Main Street", null, null, "Irvine", "CA", "92615", "US")
            .WithLine(100.0m, 1, "P0000000")

Capturing logs of API calls

The DotNet SDK allows you to capture API requests and responses either using an event hook or by logging all API calls to disk. You can use this feature to capture information about API call errors, or performance statistics, or anything else.

// You can capture logs to disk like this:

// Or you can hook the client to capture information about every API call like this:
client.CallCompleted += MyEventHandler;