Avalara Developer Network Developer avaTax

6.2 - Discounting a Transaction

You have several options for handling discounts with AvaTax. However, before we get to into the details we need to call out the different types of discounts you can apply as each is handled differently. Vendor discounts are simply a price reduction in the sale amount of an item or service. Whereas 3rd party (manufacturer) discounts are, generally speaking, a price reduction sponsored by the manufacturer where the vendor is compensated for the reduced price.

When dealing with discounts, there are four basic ways to represent a discount:

  • A reduction in the sale price
  • A line item with a negative amount
  • A discount to distribute among lines
  • A line item using the Manufacturer Discount TaxCode

Let’s review each of these in turn

Price Reduction Discounts

For this first discount exercise, we are going to perform the discount before sending the request to AvaTax for a tax calculation. So, if the item has a cost of $100 and you are applying a $10 discount, the GetTax request should have an amount of $90. This is the simplest method for handling a discount as it does not involve any additional fields or lines in the GetTax request.

Test Case - 6.2.1

Setup

  • You would like to provide a $10 discount on a $100 chair.
  • In your connector, create the following transaction:
    • Document Type: SalesInvoice
    • Document Code: Chapter-6-Test-4
    • Company Code: DEVGUIDE
    • Document Date: 2017-06-15
    • Customer Code: TESTCUSTOMER
  • Addresses:
    • SingleLocation
    • 100 Ravine Lane NE, Bainbridge Island, WA, 98110
  • Line #1:
    • Amount 100
    • TaxCode P0000000
  • Calculate tax for your transaction using AvaTax.

Assertions

  • The totalTaxCalculated amount should be $8.10. This is the amount that AvaTax determined is correct.
  • Notice that, in the transaction, there is no way to determine that a discount has been applied - you only know the discounted sale price of the transaction.
  • Some customers may choose to use Reference Fields to keep track of discounts applied as a price reduction. See Chapter 3 - Customizing Your Transaction for more information about reference fields.
  • {
      "type": "SalesInvoice",
      "code": "Chapter-6-Test-4",
      "companyCode": "DEVGUIDE",
      "date": "2017-06-15",
      "customerCode": "TESTCUSTOMER",
      "addresses": {
        "singleLocation": {
          "line1": "100 Ravine Lane NE",
          "city": "Bainbridge Island",
          "region": "WA",
          "country": "US",
          "postalCode": "98110"
        }
      },
      "lines": [
        {
          "number": "1",
          "amount": 90,
          "taxCode": "P0000000"
        }
      ]
    }
                    

Negative Amount Line Items

With this, exercise, you will simply add an additional line that contains the discounted amount as a negative extended amount. Please ensure to use the same taxCode on the discount line as the item being discounted. This will ensure that any taxability rules applied to the product/service are also applied to the discount.

Test Case - 6.2.2

Setup

  • You would like to provide a $10 discount on a $100 T-Shirt.
  • In your connector, create the following transaction:
    • Document Type: SalesInvoice
    • Document Code: Chapter-6-Test-5
    • Company Code: DEVGUIDE
    • Document Date: 2017-06-15
    • CustomerCode: TESTCUSTOMER
  • Addresses:
    • SingleLocation
    • 100 Ravine Lane NE, Bainbridge Island, WA, 98110
  • Line #1:
    • Amount 100
    • TaxCode PC040100
  • Line #2:
    • Amount -10
    • TaxCode PC040100
  • Calculate tax for your transaction using AvaTax.

Assertions

  • The totalTaxCalculated amount should be $8.10. This is the amount that AvaTax determined is correct.
  • The taxCode for the discount line should match the line being discounted.
  • {
      "type": "ReturnInvoice",
      "code": "Chapter-6-Test-5",
      "companyCode": "DEVGUIDE",
      "date": "2017-06-15",
      "customerCode": "TESTCUSTOMER",
      "addresses": {
        "singleLocation": {
          "line1": "100 Ravine Lane NE",
          "city": "Bainbridge Island",
          "region": "WA",
          "country": "US",
          "postalCode": "98110"
        }
      },
      "lines": [
        {
          "number": "1",
          "amount": 100,
          "taxCode": "P0000000"
        },
        {
          "number": "2",
          "amount": -10,
          "taxcode": "P0000000"
       }
      ]
    }
                    

Automatically Distributed Discounts

With this exercise you will pass the complete discounted amount in the discount field then identify the lines that are participating in the discount by setting the discounted field to ‘True’. Unlike the other methods, you will enter the total discount as a positive integer with this approach. If no lines have the discounted set to ‘True’, then the discount will NOT be applied.

Test Case - 6.2.3

Setup

  • You would like to provide a $10 discount on a $100 T-Shirt only.
  • In your connector, create the following transaction:
    • Document Type: SalesInvoice
    • Document Code: Chapter-6-Test-6
    • Company Code: DEVGUIDE
    • Document Date: 2017-06-15
    • CustomerCode: TESTCUSTOMER
    • Discount: 10
  • Addresses:
    • SingleLocation
    • 100 Ravine Lane NE, Bainbridge Island, WA, 98110
  • Line #1:
    • Amount 100
    • TaxCode PC040100
    • Discounted: True
  • Line #2:
    • Amount 75
    • TaxCode P0000000
    • Discounted: False
  • Calculate tax for your transaction using AvaTax.

Assertions

  • The discountAmount for Line 1 should be $10.
  • The taxableAmount for Line 1 should be $90
  • The TaxCalculated for Line 1 should be $8.10. This is the amount that AvaTax determined is correct.
  • The discountAmount for Line 2 should be $0.
  • The taxableAmount for Line 1 should be $75
  • The TaxCalculated for Line 1 should be $6.75. This is the amount that AvaTax determined is correct.
  • {
      "type": "SalesInvoice",
      "code": "Chapter-6-Test-6",
      "companyCode": "DEVGUIDE",
      "date": "2017-06-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"
        }
      ]
    }
                    

Manufacturer Discount TaxCode

When working with discounts provided by a 3rd party (ex. manufacturer coupon) the process is very similar to the discount method of adding a line with a negative amount. However in this case, instead of using the same tax code as the item being discounted, you will use the tax code for Coupons (third party) - OC030000. Check out Chapter 5 - Product Taxability for more information on tax codes and their function.

Test Case - 6.2.4

Setup

  • You would like to provide a $10 discount on a $100 T-Shirt.
  • In your connector, create the following transaction:
    • Document Type: SalesInvoice
    • Document Code: Chapter-6-Test-7
    • Company Code: DEVGUIDE
    • Document Date: 2017-06-15
    • Customer Code: TESTCUSTOMER
  • Addresses:
    • SingleLocation
    • 100 Ravine Lane NE, Bainbridge Island, WA, 98110
  • Line #1:
    • Amount 100
    • TaxCode PC040100
  • Line #2:
    • Amount -10
    • TaxCode OC030000
  • Calculate tax for your transaction using AvaTax

Assertions

  • The totalTaxCalculated amount should be $9.00. This is the amount that AvaTax determined is correct.
  • {
      "type": "SalesInvoice",
      "code": "Chapter-6-Test-7",
      "companyCode": "DEVGUIDE",
      "date": "2017-06-15",
      "customerCode": "TESTCUSTOMER",
      "addresses": {
        "singleLocation": {
          "line1": "100 Ravine Lane NE",
          "city": "Bainbridge Island",
          "region": "WA",
          "country": "US",
          "postalCode": "98110"
        }
      },
      "lines": [
        {
          "number": "1",
          "amount": 100,
          "taxCode": "P0000000"
        },
        {
          "number": "2",
          "amount": -10,
          "taxcode": "OC030000"
       }
      ]
    }