# Automatically distributed discounts

Source: https://developer.avalara.com/avatax-for-ap/lhn6852687310766/

# Automatically distributed discounts

Learn how AvaTax automatically distributes discounts across transaction lines.

Another method for discounting transactions is to automatically distribute a discount to lines in a transaction. To do this, specify a `discount` value at the document level, and then set the `discounted` to `true` or `false` (default) for each line in the transaction. AvaTax will distribute the lines proportionally for all lines that are specified as `"discounted": true`.

Imagine these two scenarios:

-   Scenario 1:

    -   Specify a `discount` of $10 at the document level.

    -   Lines 1 and 2 of the transaction each have an amount of $100 and are marked as `"discounted": true`.

    -   AvaTax applies a $5 discount to each line.

-   Scenario 2:

    -   Specify a `discount` of $30 at the document level.

    -   Line 1 shows an amount of $100 and it marks it as `"discounted": true`.

    -   Line 2 shows an amount of $200 and it marks it as `"discounted": true`.

    -   AvaTax applies a $10 discount to the first line and a $20 discount to the second line.

The following example shows a sales invoice with two lines. The first line includes a $10 discount during tax calculation. The second line doesn’t include a discount.

**Example**

```
{
  "type": "SalesInvoice",
  "code": "AutomaticallyDistributedDiscount",
  "companyCode": "DEFAULT",
  "date": "2024-07-15",
  "customerCode": "TESTCUSTOMER",
  "discount": "10",
  "addresses": {
    "singleLocation": {
      "line1": "100 Ravine Lane NE",
      "city": "Bainbridge Island",
      "region": "WA",
      "country": "US",
      "postalCode": "98110"
    }
  },
  "lines": [
    {
      "number": "1",
      "amount": 100,
      "taxCode": "P0000000",
      "discounted": "true"
    },
    {
      "number": "2",
      "amount": 75,
      "taxCode": "P0000000",
      "discounted": "false"
    }
  ]
}
```