recheej / taxjar.net

Sales Tax API Client for .NET / C#

Home Page:https://developers.taxjar.com/api/reference/?csharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TaxJar Sales Tax API for .NET / C#

Official .NET / C# client for SmartCalcs by TaxJar. For the API documentation, please visit http://developers.taxjar.com/api.

Getting Started

We recommend installing TaxJar.net via NuGet. Before authenticating, get your API key from TaxJar.

Use the NuGet package manager inside Visual Studio, Xamarin Studio, or run the following command in the Package Manager Console:

PM> Install-Package TaxJar

Package Dependencies

TaxJar.net is built for .NET Framework 4.5 and requires the following dependencies:

These packages are automatically included when installing via NuGet.

Authentication

To authenticate with our API, add a new AppSetting with your TaxJar API key to your project's Web.config / App.config file or directly supply the API key when instantiating the client:

Method A

<!-- Web.config / App.config -->
<appSettings>
...
  <add key="TaxjarApiKey" value="[Your TaxJar API Key]" />
...
</appSettings>
var client = new TaxjarApi();

Method B

var client = new TaxjarApi("[Your TaxJar API Key]");

Usage

List all tax categories

var categories = client.Categories();

List tax rates for a location (by zip/postal code)

var rates = client.RatesForLocation("90002", new {
  city = "LOS ANGELES",
  country = "US"
});

Calculate sales tax for an order

var rates = client.TaxForOrder(new {
  from_country = "US",
  from_zip = "07001",
  from_state = "NJ",
  to_country = "US",
  to_zip = "07446",
  to_state = "NJ",
  amount = 16.50,
  shipping = 1.50
});

List order transactions

var orders = client.ListOrders(new {
	from_transaction_date = "2015/05/01",
	to_transaction_date = "2015/05/31"
});

Show order transaction

var order = client.ShowOrder("123");

Create order transaction

var order = client.CreateOrder(new {
  transaction_id = "123",
  transaction_date = "2015/05/04",
  to_country = "US",
  to_zip = "90002",
  to_city = "Los Angeles",
  to_street = "123 Palm Grove Ln",
  amount = 17,
  shipping = 2,
  sales_tax = 0.95,
  line_items = new[] {
    new {
      quantity = 1,
      product_identifier = "12-34243-0",
      description = "Heavy Widget",
      unit_price = 15,
      sales_tax = 0.95
    }
  }
});

Update order transaction

var order = client.UpdateOrder(new
{
  transaction_id = "123",
  amount = 17,
  shipping = 2,
  line_items = new[] {
    new {
      quantity = 1,
      product_identifier = "12-34243-0",
      description = "Heavy Widget",
      unit_price = 15,
      discount = 0,
      sales_tax = 0.95
    }
  }
});

Delete order transaction

var order = client.DeleteOrder("123");

List refund transactions

var refunds = client.ListRefunds(new
{
  from_transaction_date = "2015/05/01",
  to_transaction_date = "2015/05/31"
});

Show refund transaction

var refund = client.ShowRefund("321");

Create refund transaction

var refund = client.CreateRefund(new
{
  transaction_id = "321",
  transaction_date = "2015/05/04",
  transaction_reference_id = "123",
  to_country = "US",
  to_zip = "90002",
  to_city = "Los Angeles",
  to_street = "123 Palm Grove Ln",
  amount = 17,
  shipping = 2,
  sales_tax = 0.95,
  line_items = new[] {
    new {
      quantity = 1,
      product_identifier = "12-34243-0",
      description = "Heavy Widget",
      unit_price = 15,
      sales_tax = 0.95
    }
  }
});

Update refund transaction

var refund = client.UpdateRefund(new
{
  transaction_id = "321",
  amount = 17,
  shipping = 2,
  line_items = new[] {
    new {
      quantity = 1,
      product_identifier = "12-34243-0",
      description = "Heavy Widget",
      unit_price = 15,
      discount = 0,
      sales_tax = 0.95
    }
  }
});

Delete refund transaction

var refund = client.DeleteRefund("321");

List nexus regions

var nexusRegions = client.NexusRegions();

Validate a VAT number

var validation = client.Validate(new {
  vat = "FR40303265045"
});

Summarize tax rates for all regions

var summaryRates = client.SummaryRates();

Tests

We use NUnit and HttpMock to directly test client methods inside Xamarin Studio.

More Information

More information can be found at TaxJar Developers.

License

TaxJar.net is released under the MIT License.

Support

Bug reports and feature requests should be filed on the GitHub issue tracking page.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new pull request

About

Sales Tax API Client for .NET / C#

https://developers.taxjar.com/api/reference/?csharp

License:MIT License


Languages

Language:C# 100.0%