Avalara Developer Network Developer blog

How to Calculate E-Waste Tax in California

In this post, we will demonstrate how to calculate e-waste tax in California. First, we need to understand unit-based rates and their implementation. Many tax rates and tariffs are ad valorem, which means tax is calculated based on the monetary value of the goods sold or shipped. Rates can also be unit-based. Unit-based rates depend on how much of an item is sold or shipped, for example volume, mass, size, or quantity.

Unit-based rates apply to many goods such as sugar, e-waste and recycling fees for electronics, lodging, and bottles. These rates have a unit of measurement and quantity. Throughout this post, we will refer to units of measurement as UOM.

Let’s show how to use unit-based rates with the AvaTax API.

How Do We Use Unit-based Rates?

We will start with an example of shipping a computer system with monitor to California, tax code PC080100. California has an e-waste recycling fee on first sales. If you call CreateTransaction using a unit-based tax code, AvaTax will tell you exactly which parameter or parameters are need for a more thorough calculation in the response description:

"description": "Attributes required for this transaction line but could NOT be located in parameter bag item. Missing Attributes/ParameterBagItems are: FirstUse,ScreenSize"

For this transaction, we see that the parameters FirstUse and ScreenSize are needed to give us a more complete tax calculation. What parameters are available in AvaTax? Using the Definitions API, you can see the full list of AvaTax parameters:

GET /api/v2/definitions/parameters

We can even use REST filtering to get back only the parameters for which we are looking:

GET /api/v2/definitions/parameters?%24filter=name%20EQ%20FirstUse%20or%20name%20EQ%20ScreenSize

In the response, the parameters for which we queried are:

{
  "@recordsetCount": 2,
  "value": [
    {
      "id": 89,
      "category": "",
      "name": "ScreenSize",
      "dataType": "NumericMeasured"
    },
    {
      "id": 90,
      "category": "",
      "name": "FirstUse",
      "dataType": "Boolean"
    }
  ]
}

Putting these together, this is our request at the line level:

"lines": [
    {
      "number": "1",
      "amount": 1000,
      "taxCode": "PC080100",
      "parameters": {
          "FirstUse" : true,
          "ScreenSize" : 15
      }
    }
  ]

Sending this line item in the request will return a tax calculation. But it comes back with something in the “messages” field that you might not have seen before:

"messages": [
        {
            "summary": "SI UOM used",
            "details": "SI UOM has been used for MeasurementType 'Length'.",
            "refersTo": "UOM Code",
            "severity": "Warning",
            "source": "Avalara.AvaTax.Services.Tax"
        }`
    ]

The warning means that AvaTax used the default Système Internationale d’Unités, or SI Unit, for calculating screen size. The SI Unit for length is the meter/metre. A screen size of 15 meters is rather large and maybe more than we intended. But how do we tell AvaTax which unit we mean? We will next explore how to tell AvaTax what UOM you want.

How to Refine E-Waste Sales Tax Requests

First, we need to know what parameters and units to use for our transaction. Let’s see what UOM are available for length:

/api/v2/definitions/unitofmeasurements?$filter=measurementTypeCode%20EQ%20Length

This request with filter checks for UOMs related to length, which returns this response (abridged):

   
    {
      "id": 139,
      "code": "FrenchGauge",
      "shortDesc": "French Gauge (charriere, Fg, FR, F)",
      "description": "french; charriere \"French Catheter Scale\"",
      "measurementTypeId": 4,
      "measurementTypeCode": "Length",
      "siUOM": "337",
      "measurementTypeDescription": "Length",
      "isSiUom": false
    },
    {
      "id": 142,
      "code": "Inch",
      "shortDesc": "Inches (in)",
      "description": "",
      "measurementTypeId": 4,
      "measurementTypeCode": "Length",
      "siUOM": "337",
      "measurementTypeDescription": "Length",
      "isSiUom": false
    },
    
    {
      "id": 157,
      "code": "Mile",
      "shortDesc": "Mile, International (mi)",
      "description": "",
      "measurementTypeId": 4,
      "measurementTypeCode": "Length",
      "siUOM": "337",
      "measurementTypeDescription": "Length",
      "isSiUom": false
    }
    

Now, that we know what units of measurement are available for length, let’s find the relevant parameters for a computer system with monitor. To do this, we can filter the DefinitionsAPI to show ‘Screen’ related parameters:

/api/v2/definitions/parameters?$filter=name%20contains%20Screen

When filtering for ‘Screen’, we receive this response:

{
  "@recordsetCount": 2,
  "value": [
    {
      "id": 89,
      "category": "",
      "name": "ScreenSize",
      "dataType": "NumericMeasured"
    },
    {
      "id": 152,
      "category": "",
      "name": "ScreenSize",
      "dataType": "NumericMeasured"
    }
  ]
}

From the response, we can see a ScreenSize parameter exists and expects a numeric value. To satisfy this requirement, we need to add the appropriate parameter and measurement information at the line level. The syntax for UOM is:

“parameters”: {
	“[parameter name]”: “[number of units of parameter]”,
	“[parameter name].UOM”: “[unit of measurement]”
}

For our computer system with monitor example, we fill this tuple of parameters with the relevant data:

"parameters": {           
          "ScreenSize": "100",
          "ScreenSize.UOM": "Inch"
}

When we put in the correct parameters and measurements, we get a response with a correct e-waste calculation (abridged):

{
  "id": 12345678,
  "code": "55aa5555-5aa5-5555-5a55-5555aa5a5555",
  "companyId": 1234567,
  "date": "2018-06-15",
  "status": "Saved",
  "type": "SalesInvoice",
  ...
  "taxOverrideType": "None",
  "taxOverrideAmount": 0,
  "taxOverrideReason": "",
  "totalAmount": 100,
  "totalExempt": 0,
  "totalDiscount": 0,
  "totalTax": 16.5,
  "totalTaxable": 100,
  ...
  "lines": [
    {
      "id": 12345678,
      "transactionId": 12345678,
      "lineNumber": "1",
      ...
      "taxCode": "PC080100",
      "taxCodeId": 6683,
      "taxDate": "2018-06-15",
      "taxEngine": "",
      "taxOverrideType": "None",
      "businessIdentificationNo": "",
      "taxOverrideAmount": 0,
      "taxOverrideReason": "",
      "taxIncluded": false,
      "details": [...],
      "nonPassthroughDetails": [],
      "lineLocationTypes": [...],
      "parameters": {
        "ScreenSize.UOM": "Inch",
        "AvaTax.LandedCost.UnitName": "Inch",
        "AvaTax.LandedCost.UnitAmount": "100",
        "ScreenSize": "100"
      },
      "hsCode": "",
      "vatCode": "",
      "vatNumberTypeId": 0
    }
  ],
  "addresses": [...],
  "locationTypes": [...],
  "summary": [
    ...
    {
      "country": "US",
      "region": "CA",
      "jurisType": "State",
      "jurisCode": "06",
      "jurisName": "CALIFORNIA",
      "taxAuthorityType": 45,
      "stateAssignedNo": "",
      "taxType": "EWaste",
      "taxName": "CA EWaste",
      "rateType": "General",
      "taxable": 0,
      "rate": 7,
      "tax": 7,
      "taxCalculated": 7,
      "nonTaxable": 0,
      "exemption": 0
    },
    ...
  ],
  "parameters": {}
}

Things to Keep in Mind

Parameters are case-sensitive, so be sure to follow the exact spelling the endpoint gives you. Consequently, when searching for information in the definitions endpoints, try changing the capitalization if you aren’t finding what you need.

In the parameters section, you will need to include both your parameter and the respective quantity. For the UOM, be sure to concatenate .UOM onto the string.

The [parameterBagMasterName].UOM syntax is unique to REST. You might not see this syntax elsewhere, but for REST, it’s the key to the conquering the UOM parameter.

Rate-Based Calculations Also Apply to Some Duties and Tariffs

In a previous blog, we discussed HS Codes and how to find the appropriate HS code for a product. For some transactions, you will need to also include the relevant HS Code at the line level. Let’s take a look at shipping sugar to Canada:

{
  "type": "SalesInvoice",
  "companyCode": "DEFAULT",
  "date": "2018-06-15",
  "customerCode": "TESTCUSTOMER",
  "isSellerImporterOfRecord": true,
  "addresses": {
    "shipFrom": {
      "line1": "100 Ravine Lane NE",
      "city": "Bainbridge Island",
      "region": "WA",
      "country": "US",
      "postalCode": "98110"
    },
    "shipTo": {
      "line1": "5222 Sherbrooke St E",
      "city": "Montreal",
      "region": "QC",
      "country": "CA",
      "postalCode": "H1N 1A1"
    }
  },
  "lines": [
    {
      "number": "1",
      "amount": 100,
      "taxCode": "P0000000",
      "hsCode": "1702908910", 
      "parameters": {
          "AvaTax.Units.Mass": "1000", 
          "AvaTax.Units.Mass.UOM": "Ton_UsCustomary"
      }
    }
  ]
}

We used the Ton_UsCustomary as the UOM here. Of course, there are several different types of tons because more is more.

E-Waste Calculations Are a Breeze!

The AvaTax API makes e-waste calculations quick and easy, so your project can move forward with accurate and reliable information. All you need are your parameters and relevant UOM, and then, you’re ready to start calculating!

Subscribe via RSS!

Back to posts