Giter VIP home page Giter VIP logo

avatax-rest-v2-dotnet-sdk's Introduction

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 or view the online Swagger documentation.

Build Status

NuGet

NuGet

Travis-CI

Travis

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) {
            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.

// 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;

avatax-rest-v2-dotnet-sdk's People

Contributors

ted-spence-avalara avatar greg-hester-avalara avatar zfrolov avatar waynemyeravalara avatar contygm avatar robertbronsonavalara avatar phillip-tsui-avalara avatar qjavalara avatar mattminke avatar han8909227 avatar cybernexus avatar

Watchers

James Cloos avatar

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.