# Fee

## The `Fees` Object

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

| Attributes                | Type                              | Description                                                                                                                      |
| ------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `portalId`                | `string`                          | Id for a portal (Ex. Amazon, Flipkart) for which fees is created                                                                 |
| `feeId`                   | `string`                          | Unique Id for fee created or Unique Id for already present fee                                                                   |
| `feeName`                 | `string`                          | Name of the created fees                                                                                                         |
| `actualName`              | `string`                          | Receivable fee Name from portal                                                                                                  |
| `isInclusiveTax`          | `string`                          | <p>Fees is tax inclusive or not</p><p>Refer <a href="../fees#enum-isinclusivetax"><code>Enum: 1, 0</code></a></p>                |
| `inclusiveTaxPercentage`  | `string`                          | Percentage of tax applicable on a fee                                                                                            |
| `chargedFee`              | `string`                          | <p>Event at which fee is charged.</p><p>Refer <a href="#enum-chargedfee"><code>Enum: cancelled, shipped, returned</code></a></p> |
| `chargedFeeCases`         | `string`                          | <p>Specific fee is charged when an item is returned. <br>It can be customer, courier or both. </p>                               |
| `courierReturnedFee`      | `string`                          | Whether fees is totally, partially or not courier returned                                                                       |
| `courierReturnedPercent`  | `string`                          | Percentage for partial courier returned fee                                                                                      |
| `customerReturnedFee`     | `string`                          | Whether fees is totally, partially or not customer returned                                                                      |
| `customerReturnedPercent` | `string`                          | Percentage for partial customer returned fee                                                                                     |
| `validityPeriod`          | `string`                          | Validity period for fees                                                                                                         |
| `validFrom`               | `string`                          | Date from which fees will be activated                                                                                           |
| `validTo`                 | `string`                          | Date at which fees will be expired                                                                                               |
| `feeRuleStatus`           | `string`                          | <p>Action to be considered for fee rules</p><p>Refer <a href="#enum-feerulestatus"><code>Enum: HIGHER, LOWER, SUM</code></a></p> |
| `fee`                     | [`array[String]`](#fee-fee-event) | <p>Detail of when is the fee charged</p><p>Also see: <strong>The fee Object</strong></p>                                         |
| `feeRules`                | [`object`](#feerules)             | <p>Details of fee rules</p><p>Also see: <strong>The feeRules Object</strong></p>                                                 |

{% endtab %}

{% tab title="Sample Object" %}

```
{
    "portalId": 4,
    "feeId": "",
    "feeName": "testFeeSnapdeal",
    "actualName": "testFee",
    "isInclusiveTax": "1",
    "inclusiveTaxPercentage": "4",
    "chargedFee": "shipped",
    "chargedFeeCases": "",
    "courierReturnedFee": "Partial",
    "courierReturnedPercent": "20",
    "customerReturnedFee": "Partial",
    "customerReturnedPercent": "10",
    "validityPeriod": "definite",
    "validFrom": "2020-03-02",
    "validTo": "2020-03-17",
    "feeRulesStatus": "lower",
    "fee": [
        {
            "eventType": "shipped",
            "eventSubType": "",
            "feeCharged": "CHARGED_FEE"
        },
        {
            "eventType": "returned",
            "eventSubType": "courier",
            "feeCharged": "REVERSED_FEE",
            "partialPercentageValue": "20"
        },
        {
            "eventType": "returned",
            "eventSubType": "customer",
            "feeCharged": "REVERSED_FEE",
            "partialPercentageValue": "10"
        }
    ],
    "feeRules": [
        {
            "details": {
                "feeRulesStatus": "lower",
                "category": [
                    323,
                    324,
                    325
                ],
                "brand": [
                    148,
                    150,
                    194
                ],
                "paymentMethod": "COD",
                "shippingZone": "Local"
            },
            "feeRanges": [
                {
                    "rangeType": "product selling price",
                    "rangeTypeUnit": "INR",
                    "minRange": "20",
                    "maxRange": "40"
                },
                {
                    "rangeType": "weight range",
                    "rangeTypeUnit": "kg",
                    "minRange": "2",
                    "maxRange": "5"
                }
            ],
            "feeValues": [
                {
                    "type": "fixed",
                    "partitionRangeType": null,
                    "value": "700",
                    "applicableOn": "Per Order Item",
                    "partitionRange": null
                },
                {
                    "type": "variable",
                    "partitionRangeType": "kg",
                    "value": "10",
                    "applicableOn": "Per Order",
                    "partitionRange": "20"
                },
                {
                    "type": "percentage",
                    "partitionRangeType": null,
                    "value": "24",
                    "applicableOn": "Per Shipment",
                    "partitionRange": null
                }
            ]
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### Enum: feeRuleStatus

| Attributes | Description                                                                         |
| ---------- | ----------------------------------------------------------------------------------- |
| `HIGHER`   | Out of all the THEN condition defined for fees, greatest amount will be considered. |
| `LOWER`    | Out of all the THEN condition defined for fees, lowest amount will be considered.   |
| `SUM`      | Sum of all the THEN condition defined for fees is considered.                       |

### fee (fee event)

| Attributes                     | Type     | Description                                |
| ------------------------------ | -------- | ------------------------------------------ |
| `fee[].eventType`              | `string` | Event for which the is fee charged         |
| `fee[].eventSubType`           | `string` | Event sub type for when is the fee charged |
| `fee[].feeCharged`             | `string` | Type of fee charged                        |
| `fee[].partialPercentageValue` | `string` | percentage value charged for the fees      |

### feeRules

| Attributes           | Type                          | Description                                                                                             |
| -------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------- |
| `feeRules.details`   | [`object`](#details)          | <p>Details of fee rules</p><p>Also see: <strong>The details Object</strong></p>                         |
| `feeRules.feeRanges` | [array`[object]`](#feeranges) | <p>Details of fee rules containing ranges</p><p>Also see: <strong>The feeRanges Object</strong></p>     |
| `feeRules.feeValues` | [`array[object]`](#feevalues) | <p>Details of action to be taken on fee rules</p><p>Also see: <strong>The feeValues Object</strong></p> |

### details

| Attributes                          | Type     | Description                                                                          |
| ----------------------------------- | -------- | ------------------------------------------------------------------------------------ |
| `feeRules[].details.feeRulesStatus` | `string` | <p>Action to be considered for rules</p><p><code>Enum: HIGHER, LOWER, SUM</code></p> |
| `feeRules[].details.category`       | `array`  | Array of categories in fee rule                                                      |
| `feeRules[].details.brand`          | `array`  | Array of brands in fee rule                                                          |
| `feeRules[].details.paymentMethod`  | `string` | Mode of Payment (COD, PREPAID)                                                       |
| `feeRules[].details.shippingZone`   | `string` | Zone where product is shipped                                                        |

### feeRanges

| Attributes                             | Type     | Description                           |
| -------------------------------------- | -------- | ------------------------------------- |
| `feeRules[].feeRanges[].rangeType`     | `string` | product selling price or weight range |
| `feeRules[].feeRanges[].rangeTypeUnit` | `string` | Unit for range type                   |
| `feeRules[].feeRanges[].minRange`      | `string` | Minimum value for range type          |
| `feeRules[].feeRanges[].maxRange`      | `string` | Maximum value for range type          |

### feeValues

| Attributes                                  | Type     | Description                                                                                                                                                                                     |
| ------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `feeRules[].feeValues[].type`               | `string` | <p>Rule considered for fees<br>Refer <a href="#enum-type"><code>Enum: FIXED, VARIABLE, PERCENTAGE</code></a></p>                                                                                |
| `feeRules[].feeValues[].partitionRangeType` | `string` | Unit in case of variable type                                                                                                                                                                   |
| `feeRules[].feeValues[].value`              | `string` | Value for fee rule type                                                                                                                                                                         |
| `feeRules[].feeValues[].applicableOn`       | `string` | <p>Fee rule applicable on conditions<br>Refer<a href="#enum-applicableon"><code>Enum: PER ORDER, PER ORDER ITEM</code></a></p><p><a href="#enum-applicableon"><code>PER SHIPMENT</code></a></p> |
| `feeRules[].feeValues[].partitionRange`     | `string` | Value for partition range type                                                                                                                                                                  |

### Enum: type

| Attributes   | Description                                              |
| ------------ | -------------------------------------------------------- |
| `FIXED`      | Fixed value of fee is charged                            |
| `VARIABLE`   | Fee charged is varied according to conditions            |
| `PERCENTAGE` | Fee is charged in percent value for different conditions |

### Enum: applicableOn

| Attributes       | Description                              |
| ---------------- | ---------------------------------------- |
| `PER ORDER`      | Fee rule to be considered per order      |
| `PER ORDER ITEM` | Fee rule to be considered per order item |
| `PER SHIPMENT`   | Fee rule to be considered per shipment   |

### Enum: isInclusiveTax

| Attributes | Description              |
| ---------- | ------------------------ |
| `1`        | Fee is tax inclusive     |
| `0`        | Fee is not tax inclusive |

### Enum: chargedFee

| Attributes  | Description                             |
| ----------- | --------------------------------------- |
| `cancelled` | Fee is charged when order is cancelled. |
| `returned`  | Fee is charged when order is returned.  |
| `shipped`   | Fee is charged when order is shipped.   |
