When processing outgoing payments, our platform imposes certain fees, primarily associated with the banking channels used for fiat currency transactions. Below is the breakdown of the fee structure and the calculation method:

Fee Types:

  • Free: No fee is charged for the transaction.
  • Fixed: A fixed fee is charged regardless of the transaction amount. This is specified in the fee_rate.
  • Ratio: The fee is calculated based on a combination of a flat rate and a percentage of the transaction amount. The exact fee is computed as follows:

Fee = Flat Rate + (Transaction Amount × Percentage Fee Rate)

Adjustments are made to ensure the fee does not fall below the minimum (min_txn_fee) or exceed the maximum (max_txn_fee) thresholds when applicable.

Calculation Example:

To facilitate local calculations on the client side for integration purposes, here is the method to calculate the transaction fee:

def calculate_fee(amount, fee):
  if fee.fee_type == 'Free':
      return 0
  elif fee.fee_type == 'Fixed':
      return fee.fee_rate
  elif fee.fee_type == 'Ratio':
      calculated_fee = fee.flat_rate + amount * fee.fee_rate
      if fee.min_txn_fee is not None and calculated_fee < fee.min_txn_fee:
          return fee.min_txn_fee
      if fee.max_txn_fee is not None and calculated_fee > fee.max_txn_fee:
          return fee.max_txn_fee
      return calculated_fee
      raise ValueError("Unsupported fee type: {}".format(fee.fee_type))