Official .NET / C# client for SmartCalcs by TaxJar. For the API documentation, please visit http://developers.taxjar.com/api.
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
TaxJar.net is built for .NET Framework 4.5 and requires the following dependencies:
- Newtonsoft.Json Popular high-performance JSON framework for .NET
- RestSharp Simple REST and HTTP API Client for .NET
These packages are automatically included when installing via NuGet.
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:
<!-- Web.config / App.config -->
<appSettings>
...
<add key="TaxjarApiKey" value="[Your TaxJar API Key]" />
...
</appSettings>
var client = new TaxjarApi();
var client = new TaxjarApi("[Your TaxJar API Key]");
var categories = client.Categories();
var rates = client.RatesForLocation("90002", new {
city = "LOS ANGELES",
country = "US"
});
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
});
var orders = client.ListOrders(new {
from_transaction_date = "2015/05/01",
to_transaction_date = "2015/05/31"
});
var order = client.ShowOrder("123");
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
}
}
});
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
}
}
});
var order = client.DeleteOrder("123");
var refunds = client.ListRefunds(new
{
from_transaction_date = "2015/05/01",
to_transaction_date = "2015/05/31"
});
var refund = client.ShowRefund("321");
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
}
}
});
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
}
}
});
var refund = client.DeleteRefund("321");
var nexusRegions = client.NexusRegions();
var validation = client.Validate(new {
vat = "FR40303265045"
});
var summaryRates = client.SummaryRates();
We use NUnit and HttpMock to directly test client methods inside Xamarin Studio.
More information can be found at TaxJar Developers.
TaxJar.net is released under the MIT License.
Bug reports and feature requests should be filed on the GitHub issue tracking page.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new pull request