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
  • 1. Create Affiliate Ref Code
  • 2. Update Widget Affiliate Config

Was this helpful?

  1. Widget Integration

Monetization

How to enable affiliate in Rango Widget?

PreviousCustomizationNextReact Router

Last updated 10 months ago

Was this helpful?

You can charge widget users a fee for any of their successful transactions performed through the widget. Below, we present a detailed tutorial on activating affiliate functionality for your decentralized application (dApp) using the Rango Widget Config.

1. Create Affiliate Ref Code

To begin, you should navigate to the and establish a connection with your EVM-compatible wallet. From there, you can generate a referral link by clicking on the "Invite Friends" button.

After creating the link, you will notice that your affiliateRef code is located at the end of the link, similar to the illustration provided. By default, Rango will utilize the wallet address you used during the link creation process to deliver your affiliate reward.

2. Update Widget Affiliate Config

By utilizing the affiliateRef that you generated in step 1, you can enable the fee collection feature within the widget by passing this parameter to the widget configuration as shown below:

import { Widget, WidgetConfig } from "@rango-dev/widget-embedded";

export default function App() {

  const config = {
    // This API key is only for test purpose. Don't use it in production.
    apiKey: 'c6381a79-2817-4602-83bf-6a641a409e32',
    affiliate: {
      // The affilaite ref code you've created on step above
      ref: 'YOUR_AFFILIATE_REF_CODE',
      // The affiliate percent you want to charge users based on input amount
      // Setting 0.1 means 0.1% of input amount
      percent: 0.1,
      // If you want to change the default wallet that you want to earn reward,  
      // you could pass your desired wallets in this property 
      wallets: {
        'ETH': 'your wallet',
        'BSC': 'your wallet',
        'POLYGON': 'your wallet',
        // ...
      }
    }
  }
              
  return (
    <div className="App">
      <Widget config={config} />
    </div>
  );
}

Whenever a user initiates a swap using the Rango Widget, you will receive a referral percent of 0.1% from the input amount. If desired, you can customize the affiliate percent by including the parameter "affiliate.percent" in the configuration. Please note that the maximum allowed value for the affiliate percent is 3 percent.

💰
Rango dApp affiliate section