# Update a Fee

## Update Fee Rule

<mark style="color:orange;">`PUT`</mark> `https://workspace.myeshopbox.com/payments/api/v1/fee`

#### Headers

| Name          | Type   | Description                          |
| ------------- | ------ | ------------------------------------ |
| Authorization | string | The Bearer token to grant API access |

#### Request Body

| Name                   | Type    | Description                                                                                                                                        |
| ---------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| forRevision            | boolean | <p>Tells whether fee is to be revised or corrected                   <br><code>true : major change</code><br><code>false : minor change</code></p> |
| version                | string  | Version of the fee after it is updated                                                                                                             |
| ruleId                 | string  | Mongo Id of the fee updated                                                                                                                        |
| fee                    | array   | <p>Detail of when fee is charged<br>Also see: <strong>The fee Object</strong></p>                                                                  |
| validFrom              | string  | Datetime from which fee will                                                                                                                       |
| validTo                | string  | Datetime when fee will be expired                                                                                                                  |
| feeRules               | object  | <p>Details of fee rules<br>Also see: <strong>The feeRules Object</strong></p>                                                                      |
| feePortalid            | number  | Id of portal for which fee is updated                                                                                                              |
| portalId               | string  | Unique Id for a portal (Ex. Amazon, Flipkart)                                                                                                      |
| feeId                  | string  | Unique Id for fee created or Unique Id for already present fee                                                                                     |
| feeName                | string  | Name of the created fees                                                                                                                           |
| isInclusiveTax         | string  | "1" if fees is tax inclusive else "0"                                                                                                              |
| inclusiveTaxPercentage | string  | Percentage of tax applicable on a fee                                                                                                              |
| validFrom              | string  | Date from which fees will be activated                                                                                                             |
| feePortalId            | string  | Unique Id for a fee on a particular portal                                                                                                         |

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

```
{
    "id": "378",
    "accountId": "28",
    "version": "2.4",
    "ruleId": "5d7f2b78ad0cf200017cebbb",
    "portalId": "2",
    "feeId": "1",
    "feeName": "",
    "isInclusiveTax": "0",
    "inclusiveTaxPercentage": 11.0,
    "fee": [
        {
            "eventType": "cancelled",
            "eventSubType": "",
            "partialPercentageValue": 0.0,
            "feeCharged": "CHARGED_FEE"
        }
    ],
    "validFrom": "2019-09-09T00:00:00.000+05:30",
    "validTo": "2019-09-11T00:00:00.000+05:30",
    "feeRules": [
        {
            "feeRanges": [
                {
                    "rangeType": "product selling price",
                    "rangeTypeUnit": "INR",
                    "minRange": 0.0,
                    "maxRange": 100.0
                }
            ],
            "feeValues": [
                {
                    "type": "fixed",
                    "value": 12.0,
                    "applicableOn": "Per Order"
                }
            ]
        }
    ],
    "feePortalId": "378",
    "forRevision": false
}
```

{% endtab %}
{% endtabs %}

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

```scheme
curl -X PUT https://workspace.myeshopbox.com/payments/api/v1/fee \
-H "Content-Type: application/json" \
-H "Authorization: Bearer XXXX" \
-d $'{
    "portalId": 3,
    "feeId": "40",
    "feeName": null,
    "isInclusiveTax": "0",
    "inclusiveTaxPercentage": "63",
    "chargedFee": "cancelled",
    "chargedFeeCases": "",
    "courierReturnedFee": "",
    "courierReturnedPercent": "",
    "customerReturnedFee": "",
    "customerReturnedPercent": "",
    "validityPeriod": "definite",
    "validFrom": "2019-09-09",
    "validTo": "2019-09-11",
    "fee": [
        {
            "eventType": "shipped",
            "eventSubType": "",
            "partialPercentageValue": "",
            "feeCharged": "CHARGED_FEE"
        },
        {
            "eventType": "returned",
            "eventSubType": "courier",
            "partialPercentageValue": "",
            "feeCharged": "REVERSED_FEE"
        },
        {
            "eventType": "returned",
            "eventSubType": "customer",
            "partialPercentageValue": "",
            "feeCharged": "REVERSED_FEE"
        }
    ],
    "feeRules": [
        {
            "details": {
                "shippingZone": "regional"
            },
            "feeValues": [
                {
                    "type": "fixed",
                    "value": 2,
                    "applicableOn": "Per Order",
                    "id": 1
                }
            ]
        }
    ],
    "id": 603,
    "ruleId": "5d7a4867ad0cf20001e527df",
    "forRevision": true
}'
```

{% endtab %}
{% endtabs %}
