# Managing regulatory fees

Once you determine that your product has a required [regulatory fee](https://docs.digitalriver.com/digital-river-api/product-management/regulatory-fees), you'll need to [describe its attributes](#setting-fee-attributes) and then [create the Fee resource](#creating-a-fee).

## Setting fee attributes

{% hint style="warning" %}
In versions `2020-09-30` and earlier, you can set the `visible` boolean parameter in [create](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/fees#fees-1) and [update fee](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/fees#fees-id-1) requests. In later versions, all [fees are visible](#displaying-fees) to customers.
{% endhint %}

Every Fee must have a [type](#type) and be [associated with a SKU](#sku-identifier). You must also define its [category](#category), [value](#value), amount, currency, and [country](#country-and-subdivisions). A full list of specifications is available on the [Fees API reference](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/fees) page.

### Type

You're required to provide the `type` of fee. The enumerated fee types are `battery`, `weee`, `copyright`, `e_waste`, and `packaging`.

You should use `weee` if you're creating a regulatory fee for [electronic waste](#weee) in the EU, and specify `e-waste` for similar products in the United States.

When you create a Fee for a [battery](#battery) or [WEEE](#weee), you can include a hash table that corresponds to the specified `type`. For example, a `POST/fees` request with a `type` of `battery` can contain a `battery` hash table. The child parameters of this data structure pass in more detailed information about the fee, which is used for reporting purposes.

```
curl --location --request POST 'https://api.digitalriver.com/fees' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_key>' \
--data-raw '{
    "type": "battery",
    "battery":{
        "quantity": 2,
        "chemicalSystem": "Alkaline",
        "iecCode": "R20" 
    },
    ...
}'
```

#### Battery

Battery fees are designed to make entities that produce and sell batteries responsible for collecting recycling fees on depleted batteries and then remitting these fees to a recycling entity. For EU compliance purposes, Digital River requires that you specify `quantity`, `chemicalSystem`, and `iecCode`.

The `quantity` parameter indicates the number of batteries within the product.

Example `chemicalSystem` values include `Alkaline`, `Nickel Cadium`, `Lithium Ion`, and`Lithium Polymer`.

The `iecCode` is an alphanumeric value that describes the battery's electrical and physical attributes. The letters and numbers in the code indicate the number of cells, cell chemistry, shape, dimensions, parallel paths in the assembled battery, and any modifying letters deemed necessary. A multi-section battery (two or more voltages from the same package) has a multi-section designation. Example codes include `R20`, `4R25X`, `4LR25-2`, `6F22`, `6P222/162`, `CR17345` and `LR2616J`.

#### WEEE

Fees with a type of `weee` represent waste electrical and electronic equipment.

The `weee` hash table only contains the `weeeRegistrationID` parameter. This registration number indicates the [compliance agency](#compliance-agency). Various jurisdictions require this number to be displayed to the customer on your storefront. Additionally, products associated with a WEEE fee must provide this identifier in the invoice.

### SKU identifier

Each Fee must be associated with a [SKU](https://docs.digitalriver.com/digital-river-api/skus#skus). You do this by providing the [unique identifier of a SKU](https://docs.digitalriver.com/digital-river-api/creating-and-updating-skus#unique-identifier) in a `POST/fees` or `POST/fees/{id}`. A single SKU can be associated with one or more Fees.

<div align="left"><img src="https://334437993-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LqH4RJfLVLuHPXuJyTZ%2F-MbbcKHCBcmHw1r0QTxC%2F-MbbcrCyII5IwKU6bbOd%2Fimage%20(4)%20(1).png?alt=media&#x26;token=c6c62551-acb4-4eed-a3bc-869827c7e1ac" alt=""></div>

### Category

The `category` parameter represents the category of the SKU as defined by regulatory law (e.g., `3. IT and Telecommunication Equipment`).

The categories are defined by and vary greatly by jurisdiction. Each product requires a category to facilitate compliance reporting.

Your \_\*\*\_Digital River Tax Manager can help you identify the product's category.

### Value

The `value` parameter identifies the product type as well as various product attributes (e.g., `5" Class Q900 QLED Smart 8K UHD TV`).

### Compliance Agency

The compliance agency represents the regulatory arm of the government that administers a country’s fee mandates. It also coordinates the recycling of physical goods and maintains recycling statistics.

When producers register with a compliance scheme, they complete the registration process with a compliance agency.

You should supply a unique identifier for the recycling agency associated with the product's jurisdiction. This alphanumeric identifier is used for reporting purposes.

### Fee Exemption

This parameter indicates whether business-to-business sales are exempt from paying the fee. If the customer is exempt (assuming a valid VAT identifier is provided), you should specify a value such as exempt. A non-exempt specification would mean the sale is not exempt from fees.

### Brand Name

The `brandName` of the product is typically the name as shown on the product itself (e.g., Jabra, Sony, AMD).

In many countries, this value is required for reporting purposes. This is true because many vendors sell products other than their own brand. For example, Logitech sells Jaybird products.

### Weight and units

The `weightAndUnits` parameter represents the unit's weight minus packaging or batteries and the unit of measurement applied to the weight.

Weights and units are required for [WEEE](#weee), [battery](#battery), and packaging reporting.

The value must be formatted as one number representing the weight plus a white space plus the weight unit (for example, `1.73 kilogram`). Furthermore, it must conform to the following regular expression: `\d{1,16}\s.{1,64}|\d{1,16}\.\d{1,2}\s.{1,64}`.

### Country and subdivisions

For the `country`, you must provide a two-letter [Alpha-2 country code](https://www.iban.com/country-codes) as described in the [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) international standard.

The optional `subdivisions`consists of an array of [ISO 3166-2 subdivision codes](https://www.iso.org/standard/63546.html).

## Creating a fee

Perform the following steps to create a regulatory fee for a product:

1. [Create the SKU](https://docs.digitalriver.com/digital-river-api/product-management/creating-and-updating-skus) that requires a fee and retrieve its unique identifier.
2. Consult with your Customer Success or Account Manager regarding how to configure the product's fees.
3. In a `POST/fees` request, specify the associated `skuId`and other required and optional parameters.

The following `POST/fees` request indicates the fee pertains to [WEEE](#weee):

{% tabs %}
{% tab title="cURL" %}

```
curl --location --request POST 'https://api.digitalriver.com/fees' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API_key>' \
--data-raw '{
    "type": "weee",
    "skuId": "f153fa2a-f442-4822-853a-c85b12a03490",
    "category": "OLED TVs.",
    "value": "85\" Class Q900 QLED Smart 8K UHD TV.",
    "amount": 1.75,
    "currency": "USD",
    "country": "ES",
    "complianceAgency": "Test compliance agency",
    "feeExemption": "Test fee exemption",
    "brandName": "Test brand name",
    "weightAndUnits": "100 kilograms"
}'
```

{% endtab %}
{% endtabs %}

A `201 Created` response returns a [Fee object](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/fees) with a unique identifier. The Fee is associated with a SKU:

```javascript
{
    "id": "fee_1b54665d-d38b-4ad7-afbb-8014608e6031",
    "skuId": "f153fa2a-f442-4822-853a-c85b12a03490",
    "category": "OLED TVs.",
    "value": "85\" Class Q900 QLED Smart 8K UHD TV.",
    "amount": 1.75,
    "complianceAgency": "Test compliance agency",
    "feeExemption": "Test fee exemption",
    "brandName": "Test brand name",
    "weightAndUnits": "100 kilograms",
    "currency": "USD",
    "country": "ES",
    "createdTime": "2020-09-09T23:42:31Z",
    "updatedTime": "2020-09-09T23:42:31Z",
    "type": "weee",
    "liveMode": false
}
```

## Displaying fees

Some jurisdictions require fee-exclusive pricing, meaning any fees attached to a product must be displayed to the customer during checkout.

As a result, whenever we give you back a [Checkout](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/checkouts), [Order](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/orders), or [Invoice ](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/invoices)object, Digital River provides [aggregate](https://docs.digitalriver.com/digital-river-api/integration-options/checkouts/creating-checkouts/accessing-regulatory-fee-information#determining-the-aggregated-fee-amount) and [product-level](https://docs.digitalriver.com/digital-river-api/integration-options/checkouts/creating-checkouts/accessing-regulatory-fee-information#getting-information-on-specific-fees) fee information. This lets you give your customers a detailed breakdown of the product's fees.

## Deleting a fee

There are two ways a Fee can be deleted. The approach you choose depends on whether you want to delete only the Fee object or whether you want to delete both the Fee and the [SKU it is associated with](#sku-identifier).

To delete only the Fee object, use the Fees API and pass its unique identifier in a [`DELETE /fees/{id}`](https://app.gitbook.com/s/x8fSFzVR3sg0TsNWwwVz/fees#fees-id-2) request. This also removes the association between the Fee and the SKU it was attached to.

Fee objects are also deleted when the SKU associated with them is deleted. So submitting a [delete SKU request](https://docs.digitalriver.com/digital-river-api/creating-and-updating-skus#deleting-a-sku) using the SKUs API deletes the SKU and all its associated fees.
