Rango Docs
API SwaggerWidget PlaygroundAppWebsite
  • 👋Welcome to Rango
  • 🏠Introduction
  • 💁How It Works
  • ✅Integrations
  • ⚖️Rango vs. Competitors
  • 🔐Security
  • 🛣️Roadmap
  • 🦎Tokenomics
  • 💰Airdrop
  • ❓FAQ
  • 🐞Bug Bounty
  • API Integration
    • 🔡Terminology
    • 🚄API Key & Rate Limits
    • 🤝Choosing the Right API
    • 🦄Basic API - Single Step
      • 🛝API Flow
      • ⚙️API Reference
        • Get Blockchains & Tokens
        • Get Quote
        • Create Transaction (Swap)
        • Check Transaction Status
        • Check Approve Transaction Status
        • Get Address Assets & Balances
        • Get Token Balance
        • Report Transaction Failure
        • Get Direct Tokens
        • Get Custom Token
        • Message Passing
      • 🎓Tutorial
        • 🍰SDK Example
      • 💰Monetization
      • 🎹Sample Transactions
      • ✅Integration Checklist
    • 🦎Main API - Multi Step
      • 🛝API Flow
      • ⚙️API Reference
        • Get Blockchains & Tokens
        • Get Best Route
        • Get All Possible Routes
        • Confirm Route
        • Create Transaction
        • Check Transaction Status
        • Check Approve Transaction Status
        • Report Transaction Failure
        • Get Custom Token
        • Get Address Token Balance
      • 🎓Tutorial
        • 🍰SDK Example
      • 💰Monetization
      • 🎹Sample Transactions
  • ℹ️API Troubleshooting
  • Technical Docs
    • 🍔Swap Aggregation
    • 💰Monetization
    • ⛽Fee Structure
    • ⛽Network Fees and Gas Estimates
    • ⌛Stuck Transactions
  • Widget Integration
    • 🧩Overview
    • 🎇Quick Start
    • ⚙️Customization
    • 💰Monetization
    • 🛣️React Router
    • 🎵Events
    • 💳External Wallets
  • Smart Contracts
    • 👩‍💼Architecture
    • 🔎Audit Reports
    • 🏗️Deployment Addresses
    • 📩Message Passing
  • Ask for Integration
    • 🙋‍♂️DEXs & DEX Aggregators
    • 📱Rango Mobile SDK
  • Useful Links
    • Twitter
    • Discord Server
    • TG Announcements
    • TG Group
  • Terms of Use
  • Privacy policy
Powered by GitBook
On this page
  • How Rango affiliate system works?
  • How to set affiliate parameters?

Was this helpful?

  1. API Integration
  2. Main API - Multi Step

Monetization

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

PreviousSDK ExampleNextSample Transactions

Last updated 9 months ago

Was this helpful?

How Rango affiliate system works?

How to set affiliate parameters?

In main api, it's enough to pass affiliate parameters only in routing methods e.g. in 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"
    },
})
curl --request POST \
     --url 'https://api.rango.exchange/routing/best?apiKey=c6381a79-2817-4602-83bf-6a641a409e32' \
     --header 'content-type: application/json' \
     --data '
{
  "from": {
    "blockchain": "BSC",
    "symbol": "BNB"
  },
  "to": {
    "blockchain": "AVAX_CCHAIN",
    "symbol": "USDT.E",
    "address": "0xc7198437980c041c805a1edcba50c1ce5db95118"
  },
  "checkPrerequisites": false,
  "affiliateWallets": {
    "BSC": "0x6f33bb1763eebead07cf8815a62fcd7b30311fa3"
  },
  "amount": "1",
  "affiliatePercent": 0.3,
  "slippage": 1
}
'

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"
    },
})
curl --request POST \
     --url 'https://api.rango.exchange/routing/best?apiKey=c6381a79-2817-4602-83bf-6a641a409e32' \
     --header 'content-type: application/json' \
     --data '
{
  "from": {
    "blockchain": "BSC",
    "symbol": "BNB"
  },
  "to": {
    "blockchain": "AVAX_CCHAIN",
    "symbol": "USDT.E",
    "address": "0xc7198437980c041c805a1edcba50c1ce5db95118"
  },
  "selectedWallets": {
    "BSC": "0xeae6d42093eae057e770010ffd6f4445f7956613",
    "AVAX_CCHAIN": "0xeae6d42093eae057e770010ffd6f4445f7956613"
  },
  "checkPrerequisites": true,
  "affiliateWallets": {
    "BSC": "0x6f33bb1763eebead07cf8815a62fcd7b30311fa3"
  },
  "amount": "1",
  "affiliatePercent": 0.3,
  "slippage": 1
}
'

🦎
💰
💰Monetization
getBestRoute