💰Monetization

How to take fees from the users using Rango Main API?

How Rango affiliate system works?

💰Monetization

How to set affiliate parameters?

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:

const bestRoute = await rango.getBestRoute({
    from: {"blockchain": "BSC", "symbol": "BNB", "address": null},
    to: {"blockchain": "AVAX_CCHAIN", "symbol": "USDT.E", "address": "0xc7198437980c041c805a1edcba50c1ce5db95118"},    
    amount: "1",
    slippage: 1,
    checkPrerequisites: false,
    affiliatePercent: 0.3,
    affiliateWallets: {
        "BSC": "0x6f33bb1763eebead07cf8815a62fcd7b30311fa3"
    },
})

Example code for the moment the user confirms the route:

const bestRoute = await rango.getBestRoute({
    from: {"blockchain": "BSC", "symbol": "BNB", "address": null},
    to: {"blockchain": "AVAX_CCHAIN", "symbol": "USDT.E", "address": "0xc7198437980c041c805a1edcba50c1ce5db95118"},    
    amount: "1",
    slippage: 1,
    checkPrerequisites: true,
    selectedWallets: {
        "BSC": "0xeae6d42093eae057e770010ffd6f4445f7956613",
        "AVAX_CCHAIN": "0xeae6d42093eae057e770010ffd6f4445f7956613",
    },
    affiliatePercent: 0.3,
    affiliateWallets: {
        "BSC": "0x6f33bb1763eebead07cf8815a62fcd7b30311fa3"
    },
})

Last updated