π°Monetization
How to take fees from the users using Rango Basic API?
How Rango affiliate system works?
π°MonetizationHow to set affiliate parameters?
In the quote endpoint, you should include the
referrerFee
field, which represents the fee amount you want to charge the user as a percentage (1.12 means 1.12 percent). Note that the maximum amount fee you could charge the user is 3 percent. It is required to calculated quote fee correctly for the user. The default fee is 10 bps or 0.1 percent.In the swap endpoint, you should pass both
referrerAddress
andreferrerFee
fields. ThereferrerFee
is the same as the field inquote
endpoint, and thereferrerAddress
is the wallet address which you wish to receive your collected fees. For thereferrerAddress
, you can use EVM, Starknet, or Osmosis wallet addresses depending on the route. While we also support fee charging on the Solana blockchain, this feature is not yet available for all dApps due to its complexity and is not ready for public use.
Here is a sample code for setting affiliate fee parameters in quote method:
const quote = await rango.quote({
from: {"blockchain": "BSC", "symbol": "BNB", "address": null},
to: {"blockchain": "AVAX_CCHAIN", "symbol": "USDT.E", "address": "0xc7198437980c041c805a1edcba50c1ce5db95118"},
amount: "100000000000000000", // 0.1 BSC.BNB
slippage: "1.0",
referrerFee: "0.1" // charge users 0.1% fee for the input token
})
Here is a sample code for setting affiliate fee parameters in swap method:
const swap = await rango.swap({
from: {"blockchain": "BSC", "symbol": "BNB", "address": null},
to: {"blockchain": "AVAX_CCHAIN", "symbol": "USDT.E", "address": "0xc7198437980c041c805a1edcba50c1ce5db95118"},
amount: "100000000000000000" // 0.1 BSC.BNB
slippage: "1.0",
fromAddress: "0xeb2629a2734e272bcc07bda959863f316f4bd4cf",
toAddress: "0xeb2629a2734e272bcc07bda959863f316f4bd4cf",
disableEstimate: true,
referrerFee: "0.1",
referredAddress: "0x7g44bb1763eebead07cf8815a62fcd7b30311fb1"
})
Last updated
Was this helpful?