Comment on page
💵
Monetization
How to enable affiliate in Rango Widget?
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.
To begin, you should navigate to the Rango dApp affiliate section 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.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.
Last modified 28d ago