Skip to main content

Commission pre-calculation

Overview​

Commission pre-calculation allows you to estimate payout fees before creating a payout.

Use this method when you need to show the expected fee to the user, decide who pays the fee, or calculate the final payout amount before calling payout creation methods.

When to use this API​

Use commission pre-calculation before creating:

  • a single payout;
  • a mass payout;
  • a payout where the merchant wants to pass all or part of the fee to the user.

For payout fee calculation, use opType: WITHDRAWAL.

Fee types​

feeTypeDescription
SERVICEThe full service fee is included in the user-paid part. In the response, use feeReceiver to see the amount after the full fee is deducted.
FIXOnly the fixed fee is included in the user-paid part. In the response, fixedFee shows the fixed fee amount.
PERCENTOnly the percentage fee is included in the user-paid part. In the response, percentFee shows the percentage fee amount.

Integration flow​

  1. Choose the payout amount, payout currency, and feeType that matches your fee logic.
  2. Send a request to [POST] tariff/extended-fee with opType: WITHDRAWAL.
  3. Use feeReceiver when the fee should be included in the payout amount or partially paid by the user.
  4. Use feeSender when the fee should be calculated on top of the payout amount. To create the payout with the fee paid by the sender, use the calculated amount and fee values according to your business logic.

API methods​

Calculate payout fee - [POST] tariff/extended-fee​

Request fields​

FieldTypeRequiredDescription
timestampnumberYesCurrent Unix UTC timestamp in milliseconds. The value must not be less than 3 minutes in the past or greater than 3 minutes in the future.
payloadobjectYesObject with fee calculation request data.

Payload fields​

FieldTypeRequiredDescription
itemsarrayYesList of items for fee calculation. Must contain at least one item.

items fields​

FieldTypeRequiredDescription
baseAmountnumberYesPayout amount for fee calculation.
currencystringYesCurrency ticker of the payout.
opTypestringYesOperation type. For payout fee calculation, use WITHDRAWAL.
feeTypestringYesFee type: SERVICE, FIX, or PERCENT.

Request example​

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

Response fields​

FieldTypeDescription
itemsarrayList of calculated fee results.

items response fields​

FieldTypeDescription
amountnumberInitial transaction amount used for calculation.
currencystringCurrency ticker.
opTypestringOperation type used for calculation.
feeReceiverobjectCalculation where fee is deducted from the amount received by the recipient.
feeSenderobjectCalculation where fee is added on top of the payout amount and paid by the sender.

feeReceiver and feeSender fields​

FieldTypeDescription
amountnumberResulting transaction amount for the selected fee scenario.
feenumberTotal calculated fee amount.
fixedFeenumberFixed fee amount.
percentFeenumberPercentage fee amount.

Response example 200 OK​

{
"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
}
}
]
}

How to read the result​

ScenarioField to useDescription
Fee is included in the payout amountfeeReceiverShows how much the recipient receives after the selected fee is deducted.
Fee is paid on top of the payout amountfeeSenderShows the payout amount and the fee calculated on top of it.
User pays only fixed feefeeReceiver.fixedFee or feeSender.fixedFeeUse when feeType: FIX.
User pays only percentage feefeeReceiver.percentFee or feeSender.percentFeeUse when feeType: PERCENT.
User pays full service feefeeReceiver.fee or feeSender.feeUse when feeType: SERVICE.

Errors and edge cases​

CaseDescription
Unsupported currencyThe fee cannot be calculated if the currency is not available for payout operations.
Incorrect operation typeFor payout fee calculation, opType must be WITHDRAWAL.
Incorrect fee typefeeType must be one of SERVICE, FIX, or PERCENT.
Fee calculation resultUse the calculation result when preparing the payout request and showing the fee to the user.
DocumentLink
Single payout APIHow to create a single payout via API
Mass payout APIHow to create a mass payout via API
Tariff API referenceTariff API