Skip to main content
Platform fees allow integrators to monetize their DFlow integrations by collecting fees on trades executed through their applications. By default, there are zero protocol fees on DFlow trades. Integrators can optionally introduce a platform fee by specifying fee parameters on DFlow’s API endpoints. DFlow supports two types of platform fees: Fixed and Dynamic.
  • Fixed Platform Fees: A simple percentage-based fee specified in basis points.
  • Dynamic Platform Fees: A price-dependent fee that scales with market probability, used specifically for prediction market outcome token trades.

Use Case

Integrators building applications on top of DFlow can collect platform fees on every trade executed through their integration. This enables monetization of your integration while providing value to end users through DFlow’s aggregated liquidity and routing. Platform fees are specified in basis points (1 basis point = 0.01%). For example, a 20 bps fee equals 0.2% of the trade amount. You can collect fees from either the input or output token of the swap, depending on your configuration.

Platform Fee Parameters

DFlow provides three key parameters for configuring platform fees:

platformFeeMode

Controls which token the platform fee is collected from. See the platformFeeMode parameter in the API reference.
  • outputMint (default): Fee is collected from the output token of the swap
  • inputMint: Fee is collected from the input token of the swap
For outcome token trades, platformFeeMode is ignored and the fee is always collected in the settlement mint.

platformFeeBps

A fixed platform fee specified in basis points (1 basis point = 0.01%). See the platformFeeBps parameter in the API reference.
  • Example: platformFeeBps: 50 means a 0.5% fee
  • The fee is calculated as a percentage of the trade amount
  • Can be collected from either input or output mint based on platformFeeMode

platformFeeScale

A dynamic fee scale used specifically for outcome token trades. See the platformFeeScale parameter in the API reference. The fee is calculated using the formula: k * p * (1 - p) * c Where:
  • k = platformFeeScale (with 3 decimals precision, e.g., 50 = 0.050)
  • p = all-in price (includes all fees + filled price)
  • c = contract size
When p = 1 (redemption of a winning outcome), the fee is zero. Users do not pay a fee for outcome mint redemption.

Fee Account Requirements

To collect platform fees, you must specify a feeAccount parameter on the API endpoints:
  • The fee account must be a valid token account that matches the fee mint (input or output token, depending on platformFeeMode)
  • For outcome token trades, the fee account must be a settlement mint account
  • The fee account must be initialized before the trade executes
You can use the referralAccount parameter to automatically create the fee account if it doesn’t exist. The fee account will be derived from the referral account using the Referral program.
The fee account must match the token you’re collecting fees in. For example, if you’re collecting fees from the output mint (USDC), the fee account must be a USDC token account. You cannot collect fees in a token that isn’t part of the swap.