# Send the original invoice date as the tax calculation date for refunds

Source: https://developer.avalara.com/ecommerce-integration-guide/transactions/certification-requirements/send-original-invoice-date-for-return/

**Element type:** Required for Refunds

**Endpoints/models used:** [CreateTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/), [RefundTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/RefundTransaction/)

Tax rates can change. Imagine you have a customer who purchases an item on October 1, and the tax rate then is 10%. Then on October 15, the tax rate changes to 12.5%. On October 30, the customer returns the item purchased on October 1. You want to calculate the return credit using the tax rate calculated on the date of purchase, when the calculated tax was 10%. You don’t want to refund tax at the newer rate of 12.5%. To do this, you must provide a method to use the original invoice date as the tax calculation date for the refund. This isn’t the same as changing the post date for the refund. In this scenario, the date of the refund should still be October 30.

When issuing refunds using the [CreateTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/) API, use a `taxOverride` of `TaxDate`.

When issuing refunds using the [RefundTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/RefundTransaction/) API, your workflow should recognize the date of the original transaction based on the `transactionCode` in the endpoint URL and pass that as the tax calculation date for the return.

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

When using CreateTransaction, include the original transaction date in the tax override. In the example below, the date of the original transaction is June 29, 2024.

```
{  "lines": [    {      "number":"1",      "quantity":1,      "amount":-100,      "taxCode":"P0000000",      "itemCode":"Test SKU",      "description":"Test Item Description"    }  ],  "taxOverride":{    "type": "TaxDate",    "taxDate":"2024-06-29",    "reason": "Return"  },  "addresses": {    "singleLocation":{      "line1":"100 Ravine Ln NE",      "city":"Bainbridge Island",      "region":"WA",      "country":"US",      "postalCode":"98110-2687"    }  },   "type":"ReturnInvoice",  "code":"TestTransactions1",  "companyCode":"DEFAULT",  "date":"2024-07-12",  "customerCode":"Test Customer ID",  "commit":true,  "currencyCode":"USD"}        
```

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

When using RefundTransaction, AvaTax will retrieve the date of the original transaction based on the `transactionCode` in the request URL. The `transactionCode` must match the original invoice code. In the example below, the `transactionCode` for the original transaction is `TestTransactions1`.

```
curl    -X POST    -H 'Accept: application/json'    -H 'Authorization: Basic ${btoa!(`:`)}'    -H 'Content-Type: application/json'    --data '{      "refundTransactionCode": "RefundTransactionTest",      "refundDate": "2024-07-12",      "refundType": "Full",      "referenceCode": "Refund for a committed transaction"    }'    'https://sandbox-rest.avatax.com/api/v2/companies/DEFAULT/transactions/TestTransactions1/refund'        
```