Transaction Creation and Lifecycle
Learn to use the AvaTax API to create tax transactions and understand the different transaction states.
We'll cover the following...
Overview
We can describe tax transactions in Avalara as any business activity taxable by the government. This business activity includes transactions such as sales, purchases, refunds, and inventory transfers. We use the {{BASE_URL}}/transactions/
endpoint to manage these transactions.
Creating a transaction
We can record our company's taxable transactions through AvaTax, which can be of the following types: sales, purchases, inventory transfers, and returns. To create one such transaction on AvaTax for calculating taxes, we use the {{BASE_URL}}/transactions/create
endpoint and the POST method.
The {{BASE_URL}}/transactions/create
endpoint calculates the total tax applicable on all items we pass to the lines
array in this endpoint. AvaTax uses the different tax codes, rules, and profiles we define for our company for tax calculation. The complete endpoint URL for creating a transaction is as follows:
https://sandbox-rest.avatax.com/api/v2/transactions/create
Some of the request parameters for the URL above are as follows:
Request Parameters
Name | Type | Parameter Type | Category | Description |
| string | Query | Optional | This parameter specifies the objects we want the API to add in the API response to our transaction creation request. |
| string | Body | Optional | This parameter specifies the transaction's unique code, allowing us to reference it to update or reconcile it quickly. |
| array of item objects | Body | Required | This parameter lists the line items for the transaction. |
| string | Body | Optional | This parameter specifies the type of transaction. An invoice is a permanent transaction, while an order is a temporary transaction for estimations. This parameter supports the following values: |
| string | Body | Required | This parameter defines the date of the transaction. |
| string | Body | Required | This parameter specifies the customer code of the customer associated with the transaction. |
| string | Body | Optional | This parameter specifies the company code of the company associated with the transaction. |
| string | Body | Optional | This parameter specifies the three-character ISO 4217 code of the currency associated with the transaction. |
| boolean | Body | Optional | This parameter specifies whether the transaction is to be committed or not. |
| location object | Body | Required | This address specifies where our company made the sale and what tax jurisdiction the transaction would fall in. If this address and the company address are different, the calculated tax will be zero. |
Let’s see ...