# Discounts scenario

Source: https://developer.avalara.com/avatax-dm-combined-erp/sales-tax-badge/transactions/test-discounts/

# Discounts scenario

This scenario looks at how discounts are handled 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 your company is configured 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 items for the discount. In the example below, the discount amount of $50 has been distributed 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.

![](https://www.avalara.com/content/dam/assets/ui/screenshots/test-discounts.png)

## Example

Click on the request and response below to view a working example using cURL.

Request

```
curl    -X POST    -H 'Accept: application/json'    -H 'Authorization: Basic aHR0cHdhdQNoOmY='    -H 'Content-Type: application/json'    --data '{        "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":"Discounts Scenario",         "type":"SalesInvoice",         "companyCode":"DICEYREILLYS",         "date":"2021-03-08",         "customerCode":"Test Customer ID",         "commit":true,         "currencyCode":"USD",         "discount":50    }'    'https://sandbox-rest.avatax.com/api/v2/transactions/create'
```

Response

```
{  "id": 0,  "code": "Discounts Scenario",  "companyId": 365522,  "date": "2021-03-08  "paymentDate": "2021-03-08",  ...  "totalDiscount": 50,  "lines": [    {      "id": 0,      "transactionId": 0,      "lineNumber": "1",      "customerUsageType": "",      "entityUseCode": "",      "description": "Test Item Description",      "discountAmount": 28.57,      ...    },    {      "id": 0,      "transactionId": 0,      "lineNumber": "2",      "customerUsageType": "",      "entityUseCode": "",      "description": "Test Item Description",      "discountAmount": 21.43,      ...    },    {      "id": 0,      "transactionId": 0,      "lineNumber": "3",      "customerUsageType": "",      "entityUseCode": "",      "description": "Common Carrier",      "discountAmount": 0,      ...    }  ...}
```

[Previous](/avatax-dm-combined-erp/sales-tax-badge/transactions/test-tax-amount)

[Next](/avatax-dm-combined-erp/sales-tax-badge/transactions/test-entity-use-code)