# Override a transaction

Source: https://developer.avalara.com/vat-ecom/transactions/discounts-and-overrides/override-a-transaction/

AvaTax allows you to override calculated tax by specifying a [tax override](https://developer.avalara.com/api-reference/avatax/rest/v2/models/TaxOverrideModel/) at either the document level or line level of a transaction.

The following types of override objects are supported: `taxAmount`, `taxDate`, and `taxAmountByTaxTypes`. Each of these is described later in this topic.

-   The `taxAmount` override will do just that, override the tax amount on the transaction. This is helpful if you need to record transactions to AvaTax that had the tax calculated in another system.

-   The `taxDate` override allows you to specify what tax date to use in the calculation. By default, AvaTax uses the document `date` as the `taxDate`. The common use case for this override is processing refunds - you want to calculate the refund tax credit using the same information that the original sale used.

-   The `taxAmountByTaxTypes` is used with customs duty and import tax and is only available on the line level. This override allows you to specify a total override of the calculated tax on the line with a specific tax type. AvaTax distributes the override across all the line details for that tax type.

When performing a tax override, AvaTax expects you to specify one of the following tax types:

-   `None`: Indicates that AvaTax calculated tax for this transaction, and no override occurred.

-   `TaxAmount`: Indicates that AvaTax calculated tax for this transaction, but the final tax amount on the transaction was determined outside of AvaTax. To see the amounts determined by AvaTax, review the `taxCalculated` field in the response; to see the amounts determined by the customer's outside tax engine, review the `taxAmount` field. This behavior can also occur when a customer requests a refund. For refunds calculated using the [RefundTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/RefundTransaction/) API, AvaTax ensures that the exact tax charged to the customer is refunded to the customer using a tax amount override.

-   `Exemption`: Indicates that the entity exemption was ignored.

-   `TaxDate`: Indicates that AvaTax calculated tax on this transaction using the tax rules in effect on a date other than when the transaction occurred. This behavior typically occurs during refunds. If the customer attempts to return a product without a receipt that shows the exact amount paid, AvaTax can calculate tax on the date when they believed the product was purchased.

-   `AccruedTaxAmount`: An override used in Consumer Use Tax transactions.

-   `DeriveTaxable`: AvaTax derives the taxable amount from the tax amount.

-   `OutOfHarbor`: Indicates transaction data where the tax was determined by a system other than AvaTax and then passed into AvaTax.

-   `TaxAmountByTaxType`: Used to override a specify tax amount for a specific tax type.

-   `VendorChargedTax`: Overrides tax calculated by a vendor in Consumer Use Tax transactions.

## Overriding the tax amount

A `taxAmount` override overrides the tax amount of a transaction rather than using the AvaTax calculated value. This feature is available so that you can import transactions where you’ve already calculated the tax amount before using AvaTax. An example would be importing data from an older system so that you can keep all of your data in AvaTax. Other customers may choose to use this feature to import data from partner sales - for example, if you were selling via a merchant platform and you wanted to import your data into AvaTax.

[![Closed](https://avalara-devdocs-prod.mcoutput.com/vat-ecom/Skins/Default/Stylesheets/Images/transparent.gif)View example](javascript:void\(0\);)

```
{  "type": "SalesInvoice",  "code": "TaxAmountOverride",  "companyCode": "DEFAULT",  "date": "2024-07-15",  "customerCode": "TESTCUSTOMER",  "addresses": {    "singleLocation": {      "line1": "100 Ravine Lane NE",      "city": "Bainbridge Island",      "region": "WA",      "country": "US",      "postalCode": "98110"    }  },  "lines": [    {      "number": "1",      "amount": 100,      "taxCode": "P0000000"    }  ],  "taxOverride": {    "type": "taxAmount",    "taxAmount": 5.67,    "reason": "Importing tax calculated by previous tax software"  }}        
```

## Overriding the tax date

A `TaxDate` override is used when you want to calculate tax on a date different than the date of a document. For example, when you return a product, the tax date of the transaction would be the date of the original transaction rather than the date of the refund.

Let’s say Alice purchases a new chair from a store on May 1. She discovers that the chair doesn’t fit in her home office, and she decides to return the chair on June 1. If you calculate tax on the June 1 date, you might refund a different amount of tax to Alice than she paid on May 1. So, you use a `TaxDate` override to ensure that the tax rates are calculated as of May 1.

[![Closed](https://avalara-devdocs-prod.mcoutput.com/vat-ecom/Skins/Default/Stylesheets/Images/transparent.gif)View example](javascript:void\(0\);)

```
{  "type": "ReturnInvoice",  "code": "TaxDateOverride",  "companyCode": "DEFAULT",  "date": "2024-07-15",  "customerCode": "TESTCUSTOMER",  "addresses": {    "singleLocation": {      "line1": "100 Ravine Lane NE",      "city": "Bainbridge Island",      "region": "WA",      "country": "US",      "postalCode": "98110"    }  },  "lines": [    {      "number": "1",      "amount": -100,      "taxCode": "P0000000",      "taxOverride": {        "type": "taxDate","taxDate": "2024-06-15",        "reason": "Refund for purchase of chair"      }    }  ]}     
```

## Overriding the tax amount for a tax type

Typically used for cross-border and transactions outside of sales, use, or value-added tax transactions, the `taxAmountByTaxTypes` override allows you to specify the total tax amount to override per tax type applicable at the line level in the request.

### taxAmountByTaxTypes workflow

Follow the workflow below to use the `taxAmountByTaxTypes` override.

![](https://avalara-devdocs-prod.mcoutput.com/vat-ecom/Resources/Images/DevDot/taxamountbytaxtype-override-workflow_724x188.png)  

### taxAmountByTaxTypes fields

Field

Attribute

Description

`taxTypeId`  

string

The name of the tax type, as retrieved from the quote response

`taxAmount`  

number($double)

The amount of tax to override

### taxAmountByTaxTypes example

[![Closed](https://avalara-devdocs-prod.mcoutput.com/vat-ecom/Skins/Default/Stylesheets/Images/transparent.gif)Sales order request](javascript:void\(0\);)

The example below creates a sales order for $2,000 (USD) worth of product shipping from Mexico to Canada.

```
{  "lines": [    {      "number": "1",      "quantity": 1,      "amount": 2000,      "taxCode": "PA020000",      "hsCode": "0105159000",      "description": "Yarn"    }  ],  "addresses": {    "shipFrom": {      "line1": "",      "city": "",      "region": "",      "country": "MX",      "postalCode": ""    },    "shipTo": {      "line1": "9 McKinnon Ave",      "city": "georgetown",      "region": "",      "country": "CA",      "postalCode": "L7G 5H6"    }  },  "type": "SalesOrder",  "companyCode": "DEFAULT",  "date": "2024-07-14",  "businessIdentificationNo":"",  "customerCode": "test",  "purchaseOrderNo": "",  "commit": false,  "currencyCode": "USD",  "description": "Yarn",  "isSellerImporterOfRecord":"true"}
```

[![Closed](https://avalara-devdocs-prod.mcoutput.com/vat-ecom/Skins/Default/Stylesheets/Images/transparent.gif)Sales order response](javascript:void\(0\);)

The response shows two tax types in the details section: `LandedCost` and `Output`. We'll use this information in the next example.

```
"details": [  {      "id": 0,      "transactionLineId": 0,      "transactionId": 0,      ...,      "nonTaxableAmount": 0.0,      "rate": 0.025000,      "tax": 50.0,      "taxableAmount": 2000.0,      "taxType": "LandedCost",      "taxSubTypeId": "ImportDuty",      "taxName": "CA LandedCost",      "taxAuthorityTypeId": 45,      "taxCalculated": 50.0,      ...,  },  {      "id": 0,      "transactionLineId": 0,      "transactionId": 0,      ...,      "nonTaxableAmount": 0.0,      "rate": 0.050000,      "tax": 102.5,      "taxableAmount": 2050.0,      "taxType": "Output",      "taxSubTypeId": "O",      "taxName": "CANADA GST/TPS",      "taxAuthorityTypeId": 45,      "taxCalculated": 102.5,      ...,  },  {      "id": 0,      "transactionLineId": 0,        ...,      "nonTaxableAmount": 0.0,      "rate": 0.080000,      "tax": 160.0,      "taxableAmount": 2000.0,      "taxType": "Output",      "taxSubTypeId": "O",      "taxName": "ONTARIO HST",      "taxAuthorityTypeId": 45,      "taxCalculated": 160.0,    ...,  }
```

[![Closed](https://avalara-devdocs-prod.mcoutput.com/vat-ecom/Skins/Default/Stylesheets/Images/transparent.gif)Sales invoice example](javascript:void\(0\);)

The next step is to convert the transaction from a sales order to a sales invoice and include a `taxOverride` model. In this example, the refunded tax amount for both the `LandedCost` and `O` (for Output) tax type IDs is $10, for a total refund of $20.

```
{  "lines": [    {      "number": "1",      "quantity": 1,      "amount": 2000,      "taxCode": "PA020000",      "hsCode": "0105159000",      "description": "Yarn",       "taxOverride": {        "type": "taxAmountByTaxType",        "reason": "Refund",        "taxAmountByTaxTypes":[{          "taxTypeId":"LandedCost",          "taxAmount": 10        },        {          "taxTypeId":"O",          "taxAmount": 10        }]      }    }  ],  "addresses": {    "shipFrom": {      "line1": "",      "city": "",      "region": "",      "country": "MX",      "postalCode": ""    },    "shipTo": {      "line1": "9 McKinnon Ave",      "city": "georgetown",      "region": "",      "country": "CA",      "postalCode": "L7G 5H6"    }  },  "type": "SalesInvoice",  "companyCode": "DEFAULT",  "date": "2024-07-14",  "businessIdentificationNo":"",  "customerCode": "test",  "purchaseOrderNo": "",  "commit": false,  "currencyCode": "USD",  "description": "Yarn",  "isSellerImporterOfRecord":"true"}
```