This guide explains the fees applied in the Fintegence Partner API and how to calculate the amounts of withdrawals and exchanges before you execute them.
Fee levels are commercial terms defined in your partnership agreement. The fees that apply to your account are always returned by Get Balances, so you can read them at any time instead of hard-coding them.
The withdrawal fee is a fixed amount in the currency of the balance. It is included in the requested amount - the balance is debited with amount, and the recipient receives amount - fee. The fee covers the blockchain network fee, so no additional network fee is charged.withdrawal.minAmount also includes the fee - it is the smallest amount you can request.
With withdrawal.feeAmount: "10" and withdrawal.minAmount: "20":
Requested amount
Debited from balance
Fee
Recipient receives
20
20 DOGE
10 DOGE
10 DOGE
100
100 DOGE
10 DOGE
90 DOGE
Because the fee is included in amount, you can withdraw the full balance - the recipient receives the balance minus the fee.To send an exact amount to the recipient, request amount = recipientAmount + feeAmount.
The exchange fee is defined by exchange.feePercent of the destination balance. It is a fraction - 0.1 means 10%, 0 means no fee. The fee is calculated from the converted amount and charged in the destination currency.
totalDestinationAmount = sourceAmount * rate (rounded down to the destination precision)
fee = totalDestinationAmount * feePercent
destinationAmount = totalDestinationAmount - fee
You do not need to calculate this yourself - Create Lock returns the exact fee, totalDestinationAmount and destinationAmount before you execute the exchange.
Deposits are free. The balance is credited with the full deposited amount, and the fee field of deposits is always 0.
Read fees close to execution
Fees and minimum amounts can change according to your commercial terms. Read them from Get Balances shortly before creating a withdrawal or an exchange, instead of storing them permanently.