# Discounts scenario

Source: https://developer.avalara.com/ecommerce-integration-guide/test-transactions/core-sales/discounts-scenario/

This scenario looks at how AvaTax applies discounts on a multi-line invoice. This scenario assumes the following:

-   The `shipFrom` address is anywhere in the US.

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

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

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

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

-   Line items 1 and 2 are discounted, and the total discount amount for this invoice is $50.

## Expected result

For certification, you can either send us post-discounted amounts or a negative line item for the discount. In the example below, AvaTax distributes the discount amount of $50 proportionally across lines 1 and 2 because each line includes `"discounted":true`. In the UI, look for the **Discount** column; in the cURL response, look for the `totalDiscount` at the header level and the `discountAmount` at each line level.

![Sales invoice discounts scenario](https://avalara-devdocs-prod.mcoutput.com/avatax-for-ecom/Content/Resources/Images/DevDot/scenario-discounts_1122x544.png)  

## Example

[![Closed](https://avalara-devdocs-prod.mcoutput.com/avatax-for-ecom/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",      "discounted": true    },    {      "number":"2",      "quantity":1,      "amount":75,      "taxCode":"P0000000",      "itemCode":"Test SKU",      "description":"Test Item Description",      "discounted": true    },    {      "number":"3",      "quantity":1,      "amount":10,      "taxCode":"FR020100",      "itemCode":"Freight SKU",      "description":"Common Carrier",      "discounted": false    }  ],  "addresses": {    "shipFrom":{      "line1":"1600 Pennsylvania Ave",      "city":"Washington",      "region":"DC",      "country":"US",      "postalCode":"20006"    },    "shipTo":{      "line1":"915 F St Nw",      "city":"Washington, DC",      "region":"Washington, DC",      "country":"US",      "postalCode":"20004"    }  },   "code":" MW Discounts Scenario",  "type":"SalesInvoice",  "companyCode":"ATCWALTERS",  "date":"2024-06-26",  "customerCode":"Test Customer ID",  "commit":true,  "currencyCode":"USD",  "discount":50}
```

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

```
{  "id": 0,  "code": " MW Discounts Scenario",  "companyId": 7902221,  "date": "2024-06-26  ...  "totalDiscount": 50,  "lines": [    {      "id": 85059636365694,      "transactionId": 85059636365687,      "lineNumber": "1",      "customerUsageType": "",      "entityUseCode": "",      "description": "Test Item Description",      "discountAmount": 28.57,      ...    },    {      "id": 85059636365694,      "transactionId": 850596363656940,      "lineNumber": "2",      "customerUsageType": "",      "entityUseCode": "",      "description": "Test Item Description",      "discountAmount": 21.43,      ...    },    {      "id": 85059636365695,      "transactionId": 85059636365687,      "lineNumber": "3",      "customerUsageType": "",      "entityUseCode": "",      "description": "Common Carrier",      "discountAmount": 0,      ...    }  ...}
```