# Refunds scenario

Source: https://developer.avalara.com/marketplace-integration-guide/test-transactions/refunds/refunds-scenario/

This test ensures that your integration correctly handles refunded transactions. This scenario assumes the following:

-   The `shipFrom` address is anywhere in the U.S..

-   The `shipTo` address is in Washington DC, so be sure that you configured your company to collect tax in Washington DC.

-   The document `type` is `returnInvoice`.

-   Refund the invoice with a document `date` in the past.

-   Set negative values for line items for returns:  

    -   Line 1 `amount` is -$100, and the `taxCode` is `P0000000`.

    -   Line 2 `amount` is -$75, and the `taxCode` is `P0000000`.

    -   Line 3 `amount` is -$50, and the `taxCode` is `FR020100`.

-   Set the transaction `date` to the current date; set the tax override `taxDate` to the original invoice date.

## Expected result

Verify that your integration creates a Return invoice with negative values was created. In AvaTax, the scenario looks like the image below.

![Sales tax refunds scenario](https://avalara-devdocs-prod.mcoutput.com/avatax-for-marketplaces/Content/Resources/Images/DevDot/scenario-refund_1100x545.png)  

## Example

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

```
{  "lines": [    {      "number":"1",      "quantity":1,      "amount":-100,      "taxCode":"P0000000",      "itemCode":"Test SKU",      "description":"Test Item Description"    },    {      "number":"2",      "quantity":1,      "amount":-75,      "taxCode":"P0000000",      "itemCode":"Test SKU",      "description":"Test Item Description"    },    {      "number":"3",      "quantity":1,      "amount":-50,      "taxCode":"FR020100",      "itemCode":"Freight SKU",      "description":"Common Carrier"    }  ],  "taxOverride":{    "type": "TaxDate",    "taxDate":"2024-05-29",    "reason": "Return"  },  "addresses": {    "shipFrom":{      "line1":"100 Ravine Ln NE",      "city":"Bainbridge Island",      "region":"WA",      "country":"US",      "postalCode":"98110-2687"    },    "shipTo":{      "line1":"915 F St Nw",      "city":"Washington, DC",      "region":"Washington, DC",      "country":"US",      "postalCode":"20004-1493"    }  },   "code":"Refunds scenario",  "type":"ReturnInvoice",  "companyCode":"ATCWALTERS",  "date":"2024-06-26",  "customerCode":"Test Customer ID",  "commit":true,  "currencyCode":"USD"}
```

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

```
{  "id": 85059643837888,  "code": "Refunds scenario",  "companyId": 7902221,  "date": "2024-06-26",  "status": "Committed",  "type": "ReturnInvoice",  ...  "taxOverrideType": "TaxDate",  "taxOverrideAmount": 0,  "taxOverrideReason": "Return",  "totalAmount": -225,  "totalExempt": 0,  "totalDiscount": 0,  "totalTax": -13.5,  "totalTaxable": -225,  "totalTaxCalculated": -13.5,  ...  "taxDate": "2024-05-29",  ...}
```