# Commission pre-calculation

This method calculates the estimated fee for a payout transaction based on the provided parameters.\
It allows clients to preview the fee before making a payout, providing additional options for collecting fees from users and planning expenses.

With this method, you can calculate the transaction fee and:

* Pass the entire fee to the user.
* Pass only the fixed fee to the user.
* Pass only the percentage fee to the user.

| feeType | Description                                                                                                                                                                                                                                                                                           |
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SERVICE | <p>In the response to the pre-calculation for payments, in the "feeReceiver" data, the "amount" will include all transaction fees paid by the user. <br><br>The "fee" parameter will contain the total amount of fees for this transaction.</p>                                                       |
| FIX     | <p>In the fee calculation response, the "amount" parameter in the "feeReceiver" data will include the fixed transaction fee paid by the user.</p><p>The "fee" parameter will contain the total fee for this transaction, and the "fixedFee" parameter will contain the fee the user will pay.</p>     |
| PERCENT | <p>In the fee calculation response, the "amount" parameter in the "feeReceiver" data will include the percentage transaction fee paid by the user.</p><p>The fee parameter will contain the total fee for the transaction, and the "percentFee" parameter will contain the fee the user will pay.</p> |

**Pre-calculate payout commission payout via API**

{% stepper %}
{% step %}
To shift the commission to the user, select one of the values "feeType" ​​from the table above, send a request with the payout amount, payout currency and opType of "WITHDRAWAL" - [extended-fee](https://docs.calypso.finance/api-reference/tariff-api)
{% endstep %}

{% step %}
In response you will receive a calculation of the commission in the amount of the payout and on top of the payout amount:

* If you want to receive a calculation where the entire commission will be included in the payout amount or partially paid by the user, look in the "feeReceiver" parameters;
* If in the calculation you want to get where the commission amount will be calculated on top of the payment amount, look at the "feeSender" parameters, to create a payment sum up the "amount" and "fee" parameters.
  {% endstep %}
  {% endstepper %}

### **Request example:**

<table><thead><tr><th width="161.03515625">Body parameters</th><th width="100.28515625">Type</th><th width="108.5">Field</th><th>Description</th></tr></thead><tbody><tr><td>baseAmount</td><td>number</td><td><mark style="color:orange;">required</mark></td><td>Payout amount for commission calculation</td></tr><tr><td>currency</td><td>string</td><td><mark style="color:orange;">required</mark></td><td>The currency in which the payment will be made</td></tr><tr><td>opType</td><td>string</td><td><mark style="color:orange;">required</mark></td><td>To make pre-calculate payout , you must select the type - "WITHDRAWAL"</td></tr><tr><td>feeType</td><td>string</td><td><mark style="color:orange;">required</mark></td><td>Commission type to be passed on to the user:<br>- FIX<br>- PERCENT<br>- SERVICE</td></tr></tbody></table>

```
{
  "timestamp": 1,
  "payload": {
    "items": [
      {
        "baseAmount": 1000,
        "currency": "USDT",
        "opType": "WITHDRAWAL",
        "feeType": "SERVICE"
      }
    ]
  }
}-
```

### **Response example&#x20;**<mark style="color:green;">**200 OK**</mark>**:**&#x20;

<table><thead><tr><th width="213.23614501953125">Body parameters</th><th width="101.375">Type</th><th width="95.5625">Field</th><th>Description</th></tr></thead><tbody><tr><td>feeReceiver/"amount"</td><td>number</td><td><mark style="color:orange;">required</mark></td><td>The amount that the recipient's address will receive</td></tr><tr><td>feeReceiver/"fee"</td><td>number</td><td><mark style="color:orange;">required</mark></td><td>The sum of all fees for the transaction.</td></tr><tr><td>feeReceiver/"fixedFee"</td><td>number</td><td><mark style="color:orange;">required</mark></td><td>Fixed commission per transaction.</td></tr><tr><td>feeReceiver/"percentFee"</td><td>number</td><td><mark style="color:orange;">required</mark></td><td>Percentage commission for the transaction.</td></tr><tr><td>feeSender/"amount"</td><td>number</td><td><mark style="color:orange;">required</mark></td><td>The amount that the recipient's address will receive</td></tr><tr><td>feeSender/"fee"</td><td>number</td><td><mark style="color:orange;">required</mark></td><td>The sum of all fees for the transaction.</td></tr><tr><td>feeSender/"fixedFee"</td><td>number</td><td><mark style="color:orange;">required</mark></td><td>Fixed commission per transaction.</td></tr><tr><td>feeSender/"percentFee"</td><td>number</td><td><mark style="color:orange;">required</mark></td><td>Percentage commission for the transaction.</td></tr></tbody></table>

```
{
    "items": [
        {
            "amount": 1000.00,
            "currency": "USDT",
            "opType": "WITHDRAWAL",
            "feeReceiver": {
                "amount": 934.58,
                "fee": 65.42,
                "fixedFee": 18.00,
                "percentFee": 47.42
            },
            "feeSender": {
                "amount": 1000.00,
                "fee": 70.00,
                "fixedFee": 18.00,
                "percentFee": 52.00
            }
        }
    ]
}
```
