https://github.com/avadev/avatax-rest-v2-dotnet-sdk
AvaTax v2 SDK for languages using the Dot Net Framework
https://github.com/avadev/avatax-rest-v2-dotnet-sdk
Last synced: 7 months ago
JSON representation
AvaTax v2 SDK for languages using the Dot Net Framework
- Host: GitHub
- URL: https://github.com/avadev/avatax-rest-v2-dotnet-sdk
- Owner: avadev
- License: apache-2.0
- Created: 2017-01-26T19:55:13.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2025-06-26T16:50:48.000Z (about 1 year ago)
- Last Synced: 2025-06-26T17:46:43.908Z (about 1 year ago)
- Language: C#
- Size: 5.97 MB
- Stars: 28
- Watchers: 14
- Forks: 38
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> NOTICE for 19.4.1: This is a patch fixing serialization issues with version 19.4.0's AuditTransaction method. If you are having issues utilizing this method, please update your AvaTax package to 19.4.1.
>
>At this time, we do not recommend implementing code which utilizes the contents of the AuditTransaction response, because the type of this response will be updated in 19.5.0.
# AvaTax-REST-V2-DotNet-SDK
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](http://developer.avalara.com/) or view the [online Swagger documentation](https://sandbox-rest.avatax.com/swagger/ui/index.html).
# Build Status
NuGet
[](https://www.nuget.org/packages/Avalara.AvaTax/)
Travis-CI

# 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:
* http://developer.avalara.com/blog/2016/12/05/csharp-nuget-library/
# 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#:
```csharp
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) {
Console.WriteLine("Success!");
}
// 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")
.Create();
}
}
```
# 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.
```csharp
// You can capture logs to disk like this:
client.LogToFile("c:\\logs\\avataxapi.log");
// Or you can hook the client to capture information about every API call like this:
client.CallCompleted += MyEventHandler;
```