{"id":21867799,"url":"https://github.com/taxjar/taxjar-java","last_synced_at":"2025-04-14T22:34:20.960Z","repository":{"id":22508245,"uuid":"96556106","full_name":"taxjar/taxjar-java","owner":"taxjar","description":"Sales Tax API Client for Java","archived":false,"fork":false,"pushed_at":"2023-05-05T14:46:20.000Z","size":181,"stargazers_count":13,"open_issues_count":1,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-28T10:47:36.196Z","etag":null,"topics":["ecommerce","java","sales-tax","sales-tax-api","taxjar"],"latest_commit_sha":null,"homepage":"https://developers.taxjar.com/api/reference/?java","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taxjar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-07T16:21:11.000Z","updated_at":"2023-07-17T15:22:51.000Z","dependencies_parsed_at":"2024-11-28T07:15:16.222Z","dependency_job_id":null,"html_url":"https://github.com/taxjar/taxjar-java","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taxjar%2Ftaxjar-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taxjar%2Ftaxjar-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taxjar%2Ftaxjar-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taxjar%2Ftaxjar-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taxjar","download_url":"https://codeload.github.com/taxjar/taxjar-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248973052,"owners_count":21191903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecommerce","java","sales-tax","sales-tax-api","taxjar"],"created_at":"2024-11-28T05:10:34.079Z","updated_at":"2025-04-14T22:34:20.939Z","avatar_url":"https://github.com/taxjar.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TaxJar Sales Tax API for Java ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/taxjar/taxjar-java?style=flat-square\u0026label=release\u0026sort=semver)\n\n\u003ca href=\"https://developers.taxjar.com\"\u003e\u003cimg src=\"https://www.taxjar.com/img/TJ_logo_color_office_png.png\" alt=\"TaxJar\" width=\"220\"\u003e\u003c/a\u003e\n\nOfficial Java client for the [TaxJar API](https://www.taxjar.com/api/). For the API documentation, please visit [https://developers.taxjar.com/api](https://developers.taxjar.com/api/reference/?java).\n\n\u003chr\u003e\n\n[Getting Started](#getting-started)\u003cbr\u003e\n[Package Dependencies](#package-dependencies)\u003cbr\u003e\n[Authentication](#authentication)\u003cbr\u003e\n[Usage](#usage)\u003cbr\u003e\n[Custom Options](#custom-options)\u003cbr\u003e\n[Sandbox Environment](#sandbox-environment)\u003cbr\u003e\n[Tests](#tests)\u003cbr\u003e\n[More Information](#more-information)\u003cbr\u003e\n[License](#license)\u003cbr\u003e\n[Support](#support)\u003cbr\u003e\n[Contributing](#contributing)\n\n\u003chr\u003e\n\n## Getting Started\n\nWe recommend installing taxjar-java with [Maven](https://maven.apache.org/what-is-maven.html) or [Gradle](https://gradle.org/). Before authenticating, [get your API key from TaxJar](https://app.taxjar.com/api_sign_up/plus/).\n\n### Maven\n\nAdd the following dependency to your project's `pom.xml` file:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.taxjar\u003c/groupId\u003e\n    \u003cartifactId\u003etaxjar-java\u003c/artifactId\u003e\n    \u003cversion\u003e5.0.3\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\nAdd the following dependency to your project's build file:\n\n```\ncompile \"com.taxjar:taxjar-java:5.0.3\"\n```\n\n### Manual Installation\n\nYou can manually install the following JARs (including dependencies) here:\n\n- [TaxJar JAR](https://github.com/taxjar/taxjar-java/releases/latest)\n- [Retrofit](https://search.maven.org/remote_content?g=com.squareup.retrofit2\u0026a=retrofit\u0026v=LATEST)\n- [Retrofit Gson Converter](https://search.maven.org/remote_content?g=com.squareup.retrofit2\u0026a=converter-gson\u0026v=LATEST)\n\n## Package Dependencies\n\ntaxjar-java is built for **Java 1.7+** and requires the following dependencies:\n\n- [Retrofit](https://github.com/square/retrofit) - Includes [OkHttp](https://github.com/square/okhttp) and [Gson](https://github.com/google/gson)\n- [Retrofit Converter Gson](https://github.com/square/retrofit/tree/master/retrofit-converters/gson)\n\n## Authentication\n\nTo authenticate with our API, simply instantiate the client with your TaxJar API token:\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\n\npublic class AuthenticationExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n    }\n\n}\n```\n\nYou're now ready to use TaxJar! [Check out our quickstart guide](https://developers.taxjar.com/api/guides/java/#java-quickstart) to get up and running quickly.\n\n## Usage\n\n[`categories` - List all tax categories](#list-all-tax-categories-api-docs)\u003cbr\u003e\n[`taxForOrder` - Calculate sales tax for an order](#calculate-sales-tax-for-an-order-api-docs)\u003cbr\u003e\n[`listOrders` - List order transactions](#list-order-transactions-api-docs)\u003cbr\u003e\n[`showOrder` - Show order transaction](#show-order-transaction-api-docs)\u003cbr\u003e\n[`createOrder` - Create order transaction](#create-order-transaction-api-docs)\u003cbr\u003e\n[`updateOrder` - Update order transaction](#update-order-transaction-api-docs)\u003cbr\u003e\n[`deleteOrder` - Delete order transaction](#delete-order-transaction-api-docs)\u003cbr\u003e\n[`listRefunds` - List refund transactions](#list-refund-transactions-api-docs)\u003cbr\u003e\n[`showRefund` - Show refund transaction](#show-refund-transaction-api-docs)\u003cbr\u003e\n[`createRefund` - Create refund transaction](#create-refund-transaction-api-docs)\u003cbr\u003e\n[`updateRefund` - Update refund transaction](#update-refund-transaction-api-docs)\u003cbr\u003e\n[`deleteRefund` - Delete refund transaction](#delete-refund-transaction-api-docs)\u003cbr\u003e\n[`listCustomers` - List customers](#list-customers-api-docs)\u003cbr\u003e\n[`showCustomer` - Show customer](#show-customer-api-docs)\u003cbr\u003e\n[`createCustomer` - Create customer](#create-customer-api-docs)\u003cbr\u003e\n[`updateCustomer` - Update customer](#update-customer-api-docs)\u003cbr\u003e\n[`deleteCustomer` - Delete customer](#delete-customer-api-docs)\u003cbr\u003e\n[`ratesForLocation` - List tax rates for a location (by zip/postal code)](#list-tax-rates-for-a-location-by-zippostal-code-api-docs)\u003cbr\u003e\n[`nexusRegions` - List nexus regions](#list-nexus-regions-api-docs)\u003cbr\u003e\n[`validateAddress` - Validate an address](#validate-an-address-api-docs)\u003cbr\u003e\n[`validateVat` - Validate a VAT number](#validate-a-vat-number-api-docs)\u003cbr\u003e\n[`summaryRates` - Summarize tax rates for all regions](#summarize-tax-rates-for-all-regions-api-docs)\n\n\u003chr\u003e\n\nAll methods in the `Taxjar` class support synchronous and asynchronous requests. For async examples, see the project's [functional tests](https://github.com/taxjar/taxjar-java/blob/master/src/test/java/com/taxjar/functional/).\n\n### List all tax categories \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-list-tax-categories))_\u003c/small\u003e\n\n\u003e The TaxJar API provides product-level tax rules for a subset of product categories. These categories are to be used for products that are either exempt from sales tax in some jurisdictions or are taxed at reduced rates. You need not pass in a product tax code for sales tax calculations on product that is fully taxable. Simply leave that parameter out.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.categories.CategoryResponse;\n\npublic class CategoryExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            CategoryResponse res = client.categories();\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Calculate sales tax for an order \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#post-calculate-sales-tax-for-an-order))_\u003c/small\u003e\n\n\u003e Shows the sales tax that should be collected for a given order.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.taxes.TaxResponse;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\npublic class TaxExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n            params.put(\"from_country\", \"US\");\n            params.put(\"from_zip\", \"92093\");\n            params.put(\"from_state\", \"CA\");\n            params.put(\"from_city\", \"La Jolla\");\n            params.put(\"from_street\", \"9500 Gilman Drive\");\n            params.put(\"to_country\", \"US\");\n            params.put(\"to_zip\", \"90002\");\n            params.put(\"to_state\", \"CA\");\n            params.put(\"to_city\", \"Los Angeles\");\n            params.put(\"to_street\", \"1335 E 103rd St\");\n            params.put(\"amount\", 15);\n            params.put(\"shipping\", 1.5);\n\n            List\u003cMap\u003e nexusAddresses = new ArrayList();\n            Map\u003cString, Object\u003e nexusAddress = new HashMap\u003c\u003e();\n            nexusAddress.put(\"country\", \"US\");\n            nexusAddress.put(\"zip\", \"92093\");\n            nexusAddress.put(\"state\", \"CA\");\n            nexusAddress.put(\"city\", \"La Jolla\");\n            nexusAddress.put(\"street\", \"9500 Gilman Drive\");\n            nexusAddresses.add(nexusAddress);\n\n            List\u003cMap\u003e lineItems = new ArrayList();\n            Map\u003cString, Object\u003e lineItem = new HashMap\u003c\u003e();\n            lineItem.put(\"id\", 1);\n            lineItem.put(\"quantity\", 1);\n            lineItem.put(\"product_tax_code\", \"20010\");\n            lineItem.put(\"unit_price\", 15);\n            lineItem.put(\"discount\", 0);\n            lineItems.add(lineItem);\n\n            params.put(\"nexus_addresses\", nexusAddresses);\n            params.put(\"line_items\", lineItems);\n\n            TaxResponse res = client.taxForOrder(params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### List order transactions \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-list-order-transactions))_\u003c/small\u003e\n\n\u003e Lists existing order transactions created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.OrdersResponse;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class ListOrdersExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, String\u003e params = new HashMap\u003c\u003e();\n            params.put(\"from_transaction_date\", \"2015/05/01\");\n            params.put(\"to_transaction_date\", \"2015/05/31\");\n            OrdersResponse res = client.listOrders(params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Show order transaction \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-show-an-order-transaction))_\u003c/small\u003e\n\n\u003e Shows an existing order transaction created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.OrderResponse;\n\npublic class ShowOrderExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            OrderResponse res = client.showOrder(\"123\");\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Create order transaction \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#post-create-an-order-transaction))_\u003c/small\u003e\n\n\u003e Creates a new order transaction.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.OrderResponse;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\npublic class CreateOrderExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n            params.put(\"transaction_id\", \"123\");\n            params.put(\"transaction_date\", \"2015/05/04\");\n            params.put(\"from_country\", \"US\");\n            params.put(\"from_zip\", \"92093\");\n            params.put(\"from_state\", \"CA\");\n            params.put(\"from_city\", \"La Jolla\");\n            params.put(\"from_street\", \"9500 Gilman Drive\");\n            params.put(\"to_country\", \"US\");\n            params.put(\"to_zip\", \"90002\");\n            params.put(\"to_state\", \"CA\");\n            params.put(\"to_city\", \"Los Angeles\");\n            params.put(\"to_street\", \"123 Palm Grove Ln\");\n            params.put(\"amount\", 16.5);\n            params.put(\"shipping\", 1.5);\n            params.put(\"sales_tax\", 0.95);\n\n            List\u003cMap\u003e lineItems = new ArrayList();\n            Map\u003cString, Object\u003e lineItem = new HashMap\u003c\u003e();\n            lineItem.put(\"id\", \"1\");\n            lineItem.put(\"quantity\", 1);\n            lineItem.put(\"product_identifier\", \"12-34243-0\");\n            lineItem.put(\"description\", \"Heavy Widget\");\n            lineItem.put(\"unit_price\", 15);\n            lineItem.put(\"discount\", 0);\n            lineItem.put(\"sales_tax\", 0.95);\n            lineItems.add(lineItem);\n\n            params.put(\"line_items\", lineItems);\n\n            OrderResponse res = client.createOrder(params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Update order transaction \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#put-update-an-order-transaction))_\u003c/small\u003e\n\n\u003e Updates an existing order transaction created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.OrderResponse;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\npublic class UpdateOrderExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n            params.put(\"transaction_id\", \"123\");\n            params.put(\"transaction_date\", \"2015/05/04\");\n            params.put(\"from_country\", \"US\");\n            params.put(\"from_zip\", \"92093\");\n            params.put(\"from_state\", \"CA\");\n            params.put(\"from_city\", \"La Jolla\");\n            params.put(\"from_street\", \"9500 Gilman Drive\");\n            params.put(\"to_country\", \"US\");\n            params.put(\"to_zip\", \"90002\");\n            params.put(\"to_state\", \"CA\");\n            params.put(\"to_city\", \"Los Angeles\");\n            params.put(\"to_street\", \"123 Palm Grove Ln\");\n            params.put(\"amount\", 17);\n            params.put(\"shipping\", 2);\n            params.put(\"sales_tax\", 0.95);\n\n            List\u003cMap\u003e lineItems = new ArrayList();\n            Map\u003cString, Object\u003e lineItem = new HashMap\u003c\u003e();\n            lineItem.put(\"id\", \"1\");\n            lineItem.put(\"quantity\", 1);\n            lineItem.put(\"product_identifier\", \"12-34243-0\");\n            lineItem.put(\"description\", \"Heavy Widget\");\n            lineItem.put(\"unit_price\", 15);\n            lineItem.put(\"discount\", 0);\n            lineItem.put(\"sales_tax\", 0.95);\n            lineItems.add(lineItem);\n\n            params.put(\"line_items\", lineItems);\n\n            OrderResponse res = client.updateOrder(\"123\", params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Delete order transaction \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#delete-delete-an-order-transaction))_\u003c/small\u003e\n\n\u003e Deletes an existing order transaction created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.OrderResponse;\n\npublic class DeleteOrderExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            OrderResponse res = client.deleteOrder(\"123\");\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### List refund transactions \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-list-refund-transactions))_\u003c/small\u003e\n\n\u003e Lists existing refund transactions created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.RefundsResponse;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class ListRefundsExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, String\u003e params = new HashMap\u003c\u003e();\n            params.put(\"from_transaction_date\", \"2015/05/01\");\n            params.put(\"to_transaction_date\", \"2015/05/31\");\n            RefundsResponse res = client.listRefunds(params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Show refund transaction \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-show-a-refund-transaction))_\u003c/small\u003e\n\n\u003e Shows an existing refund transaction created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.RefundResponse;\n\npublic class ShowRefundExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            RefundResponse res = client.showRefund(\"123-refund\");\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Create refund transaction \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#post-create-a-refund-transaction))_\u003c/small\u003e\n\n\u003e Creates a new refund transaction.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.RefundResponse;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\npublic class CreateRefundExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n            params.put(\"transaction_id\", \"123-refund\");\n            params.put(\"transaction_reference_id\", \"123\");\n            params.put(\"transaction_date\", \"2015/05/04\");\n            params.put(\"from_country\", \"US\");\n            params.put(\"from_zip\", \"92093\");\n            params.put(\"from_state\", \"CA\");\n            params.put(\"from_city\", \"La Jolla\");\n            params.put(\"from_street\", \"9500 Gilman Drive\");\n            params.put(\"to_country\", \"US\");\n            params.put(\"to_zip\", \"90002\");\n            params.put(\"to_state\", \"CA\");\n            params.put(\"to_city\", \"Los Angeles\");\n            params.put(\"to_street\", \"123 Palm Grove Ln\");\n            params.put(\"amount\", -16.5);\n            params.put(\"shipping\", -1.5);\n            params.put(\"sales_tax\", -0.95);\n\n            List\u003cMap\u003e lineItems = new ArrayList();\n            Map\u003cString, Object\u003e lineItem = new HashMap\u003c\u003e();\n            lineItem.put(\"id\", \"1\");\n            lineItem.put(\"quantity\", 1);\n            lineItem.put(\"product_identifier\", \"12-34243-0\");\n            lineItem.put(\"description\", \"Heavy Widget\");\n            lineItem.put(\"unit_price\", -15);\n            lineItem.put(\"discount\", -0);\n            lineItem.put(\"sales_tax\", -0.95);\n            lineItems.add(lineItem);\n\n            params.put(\"line_items\", lineItems);\n\n            RefundResponse res = client.createRefund(params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Update refund transaction \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#put-update-a-refund-transaction))_\u003c/small\u003e\n\n\u003e Updates an existing refund transaction created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.RefundResponse;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\npublic class UpdateRefundExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n            params.put(\"transaction_id\", \"123-refund\");\n            params.put(\"transaction_reference_id\", \"123\");\n            params.put(\"transaction_date\", \"2015/05/04\");\n            params.put(\"from_country\", \"US\");\n            params.put(\"from_zip\", \"92093\");\n            params.put(\"from_state\", \"CA\");\n            params.put(\"from_city\", \"La Jolla\");\n            params.put(\"from_street\", \"9500 Gilman Drive\");\n            params.put(\"to_country\", \"US\");\n            params.put(\"to_zip\", \"90002\");\n            params.put(\"to_state\", \"CA\");\n            params.put(\"to_city\", \"Los Angeles\");\n            params.put(\"to_street\", \"123 Palm Grove Ln\");\n            params.put(\"amount\", -17);\n            params.put(\"shipping\", -2);\n            params.put(\"sales_tax\", -0.95);\n\n            List\u003cMap\u003e lineItems = new ArrayList();\n            Map\u003cString, Object\u003e lineItem = new HashMap\u003c\u003e();\n            lineItem.put(\"id\", \"1\");\n            lineItem.put(\"quantity\", 1);\n            lineItem.put(\"product_identifier\", \"12-34243-0\");\n            lineItem.put(\"description\", \"Heavy Widget\");\n            lineItem.put(\"unit_price\", -15);\n            lineItem.put(\"discount\", -0);\n            lineItem.put(\"sales_tax\", -0.95);\n            lineItems.add(lineItem);\n\n            params.put(\"line_items\", lineItems);\n\n            RefundResponse res = client.updateRefund(\"321\", params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Delete refund transaction \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#delete-delete-a-refund-transaction))_\u003c/small\u003e\n\n\u003e Deletes an existing refund transaction created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.transactions.RefundResponse;\n\npublic class DeleteOrderExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            OrderResponse res = client.deleteRefund(\"123-refund\");\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### List customers \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-list-customers))_\u003c/small\u003e\n\n\u003e Lists existing customers created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.customers.CustomersResponse;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class ListCustomersExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            CustomersResponse res = client.listCustomers();\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Show customer \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-show-a-customer))_\u003c/small\u003e\n\n\u003e Shows an existing customer created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.customers.CustomerResponse;\n\npublic class ShowCustomerExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            CustomerResponse res = client.showCustomer(\"123\");\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Create customer \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#post-create-a-customer))_\u003c/small\u003e\n\n\u003e Creates a new customer.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.customers.CustomerResponse;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\npublic class CreateCustomerExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n            params.put(\"customer_id\", \"123\");\n            params.put(\"exemption_type\", \"wholesale\");\n            params.put(\"name\", \"Dunder Mifflin Paper Company\");\n            params.put(\"country\", \"US\");\n            params.put(\"state\", \"PA\");\n            params.put(\"zip\", \"18504\");\n            params.put(\"city\", \"Scranton\");\n            params.put(\"street\", \"1725 Slough Avenue\");\n\n            List\u003cMap\u003e exemptRegions = new ArrayList();\n\n            Map\u003cString, String\u003e exemptRegion = new HashMap\u003c\u003e();\n            exemptRegion.put(\"country\", \"US\");\n            exemptRegion.put(\"state\", \"FL\");\n\n            Map\u003cString, String\u003e exemptRegion2 = new HashMap\u003c\u003e();\n            exemptRegion.put(\"country\", \"US\");\n            exemptRegion.put(\"state\", \"PA\");\n\n            exemptRegions.add(exemptRegion);\n            exemptRegions.add(exemptRegion2);\n\n            params.put(\"exempt_regions\", exemptRegions);\n\n            CustomerResponse res = client.createCustomer(params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Update customer \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#put-update-a-customer))_\u003c/small\u003e\n\n\u003e Updates an existing customer created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.customers.CustomerResponse;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\npublic class UpdateCustomerExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n            params.put(\"customer_id\", \"123\");\n            params.put(\"exemption_type\", \"wholesale\");\n            params.put(\"name\", \"Sterling Cooper\");\n            params.put(\"country\", \"US\");\n            params.put(\"state\", \"NY\");\n            params.put(\"zip\", \"10010\");\n            params.put(\"city\", \"New York\");\n            params.put(\"street\", \"405 Madison Ave\");\n\n            List\u003cMap\u003e exemptRegions = new ArrayList();\n\n            Map\u003cString, String\u003e exemptRegion = new HashMap\u003c\u003e();\n            exemptRegion.put(\"country\", \"US\");\n            exemptRegion.put(\"state\", \"NY\");\n\n            exemptRegions.add(exemptRegion);\n\n            params.put(\"exempt_regions\", exemptRegions);\n\n            CustomerResponse res = client.updateCustomer(\"123\", params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Delete customer \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#delete-delete-a-customer))_\u003c/small\u003e\n\n\u003e Deletes an existing customer created through the API.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.customers.CustomerResponse;\n\npublic class DeleteCustomerExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            CustomerResponse res = client.deleteCustomer(\"123\");\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### List tax rates for a location (by zip/postal code) \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-show-tax-rates-for-a-location))_\u003c/small\u003e\n\n\u003e Shows the sales tax rates for a given location.\n\u003e\n\u003e **Please note this method only returns the full combined rate for a given location.** It does not support nexus determination, sourcing based on a ship from and ship to address, shipping taxability, product exemptions, customer exemptions, or sales tax holidays. We recommend using [`taxForOrder` to accurately calculate sales tax for an order](#calculate-sales-tax-for-an-order-api-docs)).\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.rates.RateResponse;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class RatesExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, String\u003e params = new HashMap\u003c\u003e();\n            params.put(\"country\", \"US\");\n            params.put(\"city\", \"Watts\");\n            params.put(\"street\", \"123 Test St\");\n            RateResponse res = client.ratesForLocation(\"90002\", params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### List nexus regions \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-list-nexus-regions))_\u003c/small\u003e\n\n\u003e Lists existing nexus locations for a TaxJar account.\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.nexus.RegionResponse;\n\npublic class NexusRegionsExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            RegionResponse res = client.nexusRegions();\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Validate an address \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#post-validate-an-address))_\u003c/small\u003e\n\n\u003e Validates a customer address and returns back a collection of address matches. **Address validation requires a [TaxJar Plus](https://www.taxjar.com/plus/) subscription.**\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.validations.AddressResponse;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class ValidateAddressExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n            params.put(\"country\", \"US\");\n            params.put(\"state\", \"AZ\");\n            params.put(\"zip\", \"85297\");\n            params.put(\"city\", \"Gilbert\");\n            params.put(\"street\", \"3301 South Greenfield Rd\");\n\n            ValidateAddressResponse res = client.validateAddress(params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Validate a VAT number \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-validate-a-vat-number))_\u003c/small\u003e\n\n\u003e Validates an existing VAT identification number against [VIES](http://ec.europa.eu/taxation_customs/vies/).\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.validations.ValidationResponse;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class ValidateExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            Map\u003cString, String\u003e params = new HashMap\u003c\u003e();\n            params.put(\"vat\", \"FR40303265045\");\n\n            ValidationResponse res = client.validateVat(params);\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n### Summarize tax rates for all regions \u003csmall\u003e_([API docs](https://developers.taxjar.com/api/reference/?java#get-summarize-tax-rates-for-all-regions))_\u003c/small\u003e\n\n\u003e Retrieve minimum and average sales tax rates by region as a backup.\n\u003e\n\u003e This method is useful for periodically pulling down rates to use if the TaxJar API is unavailable. However, it does not support nexus determination, sourcing based on a ship from and ship to address, shipping taxability, product exemptions, customer exemptions, or sales tax holidays. We recommend using [`taxForOrder` to accurately calculate sales tax for an order](#calculate-sales-tax-for-an-order-api-docs).\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport com.taxjar.model.summarized_rates.SummaryRateResponse;\n\npublic class SummarizedRatesExample {\n\n    public static void main(String[] args) {\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\");\n\n        try {\n            SummaryRateResponse res = client.summaryRates();\n        } catch (TaxjarException e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n```\n\n## Custom Options\n\nYou can pass additional options using `setApiConfig` or when instantiating the client for the following:\n\n### API Version / Headers\n\nPass an API version with `x-api-version` or pass additional request headers:\n\n```java\nimport com.taxjar.Taxjar;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class CustomHeaderExample {\n\n    public static void main(String[] args) {\n        // Custom header when instantiating the client\n        Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n        Map\u003cString, String\u003e headers = new HashMap\u003c\u003e();\n        \n        headers.put(\"x-api-version\", \"2020-08-07\");\n        params.put(\"headers\", headers);\n\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\", params);\n\n        // Custom header via `setApiConfig`\n        client.setApiConfig(\"headers\", headers);\n    }\n\n}\n```\n\n### Timeouts\n\nThe default timeout is 30 seconds (specified in milliseconds).\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class CustomTimeoutExample {\n\n    public static void main(String[] args) {\n        // Custom timeout when instantiating the client\n        Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n        params.put(\"timeout\", 30 * 1000);\n\n        Taxjar client = new Taxjar(\"YOUR API TOKEN\", params);\n\n        // Custom timeout via `setApiConfig`\n        client.setApiConfig(\"timeout\", 30 * 1000);\n    }\n\n}\n```\n\n## Sandbox Environment\n\nYou can easily configure the client to use the [TaxJar Sandbox](https://developers.taxjar.com/api/reference/?java#sandbox-environment):\n\n```java\nimport com.taxjar.Taxjar;\nimport com.taxjar.exception.TaxjarException;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class SandboxExample {\n\n    public static void main(String[] args) {\n        Map\u003cString, Object\u003e params = new HashMap\u003c\u003e();\n        params.put(\"apiUrl\", Taxjar.SANDBOX_API_URL);\n\n        Taxjar client = new Taxjar(\"YOUR SANDBOX API TOKEN\", params);\n    }\n\n}\n```\n\n## Tests\n\nWe use [JUnit](https://junit.org/) v3.8.1 with a custom interceptor for Retrofit to directly test client methods.\n\n## More Information\n\nMore information can be found at [TaxJar Developers](https://developers.taxjar.com).\n\n## License\n\ntaxjar-java is released under the [MIT License](https://github.com/taxjar/taxjar-java/blob/master/LICENSE.txt).\n\n## Support\n\nBug reports and feature requests should be filed on the [GitHub issue tracking page](https://github.com/taxjar/taxjar-java/issues).\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new pull request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaxjar%2Ftaxjar-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaxjar%2Ftaxjar-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaxjar%2Ftaxjar-java/lists"}