Avalara Developer Network Developer avaTax

2.2 - Invoice Lines

To accurately calculate tax, you’ll need to provide some details about what is being sold. There are a number of options which will be covered in greater detail next chapter, but at minimum you will need to send the details of one line item.

  • number: AvaTax automatically numbers lines on your invoice starting with 1. If you prefer to use your own line numbers, please specify them in this value.
  • quantity: This is the quantity of goods or services being sold. Note that this value does not affect any totals; to determine the price-per-each, divide the amount value by the quantity value. If you do not provide quantity, the value will be assumed to be one. Although this field is optional, some taxes are affected by dollar-amount thresholds and caps per item, and AvaTax uses the quantity and amount values to calculate this correctly. We strongly recommend providing the correct quantity for each line.
  • amount: This is the total price of goods or services for this line item. This is the total, fully extended value. For example, if you specify a quantity of 2 and a amount of 10, this means that you have sold two $5 items for a total price of $10.
  • taxCode: This is how you specify the type of good or service that is being sold. If you omit the taxCode value, AvaTax defaults to treating the item as taxable Tangible Personal Property using the tax code P0000000. We'll go into detail on tax codes in Chapter 5 - Product Taxability. For now, it's enough to know that each line defaults to tangible personal property.
  • addresses: Each invoice line can have its own custom addresses. If we make one sale that includes multiple separate shipments, we can attach the correct address to each line. If the addresses field on a line is null or missing, the line will be assumed to use the addresses from the document level; but if the value is non-null, the line will have its own custom addresses and will not inherit any addresses from the document level.

Now that we’ve covered these additional fields, let’s take a look at a more fleshed-out version of a single location transaction. You can see that we’ve included a code value at the document level and added the number and quantity for each line. The additional fields are not strictly required, but it’s good practice to include them. Likewise, a full street address is not strictly required, but providing as much address information as is available helps to ensure that you receive the most accurate sales tax calculation.

Test Case - 2.2.1


  • In your connector, create the following transaction:
    • Document Type: SalesOrder
    • Document Code: Chapter-2-Test-2
    • Company Code: DEVGUIDE
    • Document Date: 2017-06-15
    • Customer Code: TESTCUSTOMER
    • Addresses:
      • SingleLocation
      • 100 Ravine Lane NE, Bainbridge Island, WA, US 98110
    • Lines:
      • First Line:
        • Number: A
        • Quantity: 10
        • Amount: 567.89
      • Second Line:
        • Number: B
        • Quantity: 2
        • Amount: 46.80
  • Calculate tax for your transaction using AvaTax.


Your transaction is created.
  • The code value is set to Chapter-2-Test-2
  • The date of the transaction is 2017-06-15.
  • The customerCode of the transaction is TESTCUSTOMER.
  • The first line of the invoice has lineNumber = A and quantity = 10.
  • The second line of the invoice has lineNumber = B and quantity = 2.
  • {
      "type": "SalesOrder",
      "code": "Chapter-2-Test-2",
      "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": "A",
          "quantity": 10,
          "amount": 567.89
          "number": "B",
          "quantity": 2,
          "amount": 46.80

As you can see, the CreateTransaction API grows as your transactions increase in complexity. But let’s ask - how can I make a transaction permanent, and report it to the tax authority?