💰Monetization
How to take fees from the users using Rango Main API?
Last updated
How to take fees from the users using Rango Main API?
Last updated
In main api, it's enough to pass affiliate parameters only in routing methods e.g. in getBestRoute or getAllRoutes
methods.
In these methods, several fields could be used for participating in the affiliate program: affiliateRef
, affiliateWallets
, affiliatePercent
. You could use combination ofaffiliateRef
and affiliatePercent
, or affiliateWallets
and affiliatePercent
:
affiliateRef
: The referral code you could generate on our Affiliate Program Page. If you use this, we will send the affiliate fees to the wallet that created this link.
affiliatePercent
: The fee percentage you want to charge the users (1.5 means 1.5 percent). The maximum fee you could charge users is 3 percent. The default value is 0.1 percent or 10 bps.
affiliateWallets
: A map of blockchains to wallet addresses, allowing you to specify which wallet you want to receive the fee.
Sample code for fetching the route preview:
Example code for the moment the user confirms the route: