Skip to main content
DFlow charges no protocol fee on spot trades. The platform fee described here is the fee you can set on your own integration.
Use platform fees to monetize DFlow integrations by collecting fees on trades executed through applications. Add platform fees by setting fee parameters on Trading API requests. Users pay platform fees only when a trade completes successfully. Platform fees do not affect quoting, routing, slippage checks, or execution behavior. When a trade completes, the platform fee is transferred to a fee account you control. From a user’s perspective:
  • Fees apply only on successful trades.
  • Fees change net proceeds, not execution.

Fee Models

Charge a fixed percentage of the trade amount.
  • Fees are specified in basis points (bps).
  • 1 bps = 0.01%.
  • Example: platformFeeBps: 50 means a 0.5% fee.
Decide whether the fee is collected from the input token or output token using platformFeeMode.

Platform Fee Parameters

Configure platform fees using two parameters.

platformFeeMode

Use platformFeeMode to choose which token users pay the fee in:
  • outputMint (default): fee is collected from the output token.
  • inputMint: fee is collected from the input token.
For spot trades via /order, fees can be paid in either the inputMint or outputMint.

platformFeeBps

Use platformFeeBps to set a fixed platform fee in basis points.
  • The fee is calculated as a percentage of the trade amount.
  • The fee is collected from the input or output token based on platformFeeMode.

Fee Accounts

Platform fees are transferred to a token account you control. You need a separate token account (ATA) for each token you collect fees in. For example, if your app collects fees in both USDC and SOL, you need a USDC fee account and a SOL fee account.

Using feeAccount

Pass feeAccount to specify the token account that receives the fee. The account must:
  • Be a valid SPL token account for the token being collected.
  • Already exist before the trade executes.
The token must match the fee mode:
  • Input token account when collecting from inputMint
  • Output token account when collecting from outputMint

How Platform Fees Affect Trades

Platform fees change net economics, not trade behavior.
  • Routing stays the same.
  • Slippage enforcement stays the same.
  • Execution timing stays the same.
If a trade fails, users pay no platform fee.
Only specify a nonzero platform fee if you will actually collect the fee at execution time. When the API receives a nonzero platformFeeBps, it factors the fee into slippage tolerance calculations. If the fee is declared in the request but not collected onchain, the slippage budget is effectively wasted on a fee that never gets taken, resulting in suboptimal pricing for your users.

When To Use Platform Fees

Use platform fees if you want to:
  • Monetize trading volume.
  • Fund product development.
  • Align incentives with usage.

Code Recipes

During development, you can use the developer endpoints without an API key. For production use, you’ll need an API key to avoid rate limits.
1

Set up

Imports, env config, and the wallet used across every step.
2

Fixed Fees with platformFeeBps

Use platformFeeBps to specify a fixed fee in basis points. Control which token the fee is collected from using platformFeeMode.
feeAccount is required. It must be a token account for the mint you’re collecting the fee in (input or output, per platformFeeMode) and must already exist before the trade executes.
3

Check Fee in Response

Both /order and /quote responses include platformFee information.

Send Orders

Send a spot order end-to-end.

Add Priority Fees

Control execution speed with priority fees.

Authenticate Requests

Authenticate requests for production rate limits.

API Routes