Settling Transactions

Learn to use the AvaTax API to commit or settle a tax transaction.

Committing and verifying transactions is essential in separating approximate estimates from final sales. Doing this allows us to report to the taxation authorities only the sales that we make. This helps our company during tax audits.

Committing a transaction

We use the {{BASE_URL}}/companies/{{companyCode}}/transactions/{{transactionCode}}/commit endpoint to commit existing uncommitted transactions. The complete endpoint URL for committing a transaction is as follows:

https://sandbox-rest.avatax.com/api/v2/companies/{{companyCode}}/transactions/{{transactionCode}}/commit

Some of the request parameters for the URL above are as follows:

Request Parameters

Name

Type

Parameter Type

Category

Description

companyCode

string

Path

Required

This parameter specifies the company code of the company associated with the transaction.

transactionCode

string

Path

Required

This parameter specifies the transaction's unique code, allowing us to reference the transaction to adjust it quickly.

$include

string

Query

Optional

This parameter specifies any objects we want the API to add in the API response to our request.

documentType

string

Query

Optional

This parameter specifies the company code of the company associated with the transaction. The default value of this parameter is SalesInvoice.

commit

boolean

Body

Optional

This parameter specifies whether to commit the referenced transaction.

Let’s see how to make an API call to void an existing transaction. Click the “Run” button to execute the code.

Press + to interact
Please provide values for the following:
ACCOUNT_ID
Not Specified...
LICENSE_KEY
Not Specified...
TRANSACTION_CODE
Not Specified...
COMPANY_CODE
Not Specified...
ADDRESS
Not Specified...
# Account ID and License Key
account_id = "{{ACCOUNT_ID}}"
license_key = "{{LICENSE_KEY}}"
# Transaction and Company Codes
transaction_code = create_transaction(account_id, license_key)
company_code = "{{COMPANY_CODE}}"
# Endpoint URL
endpoint_url = f"https://sandbox-rest.avatax.com/api/v2/companies/{company_code}/transactions/{transaction_code}/commit"
# Creating a basic auth token using account ID and license key
auth_token = requests.auth.HTTPBasicAuth(account_id, license_key)
# Define query parameters here
parameters = {
"$documentType": "SalesInvoice",
}
# Define body parameters here
data_obj = {
"commit": True
}
# Making a POST request to the AvaTax API
response = requests.post(url=endpoint_url, auth=auth_token,
params=parameters, json=data_obj)
# Printing response
print_response(response)

Here's an explanation for the code widget ...