# Monetization

## How Rango affiliate system works?

{% content-ref url="/pages/XLBy76udAgbv1sqg98A8" %}
[Monetization](/technical/monetization.md)
{% endcontent-ref %}

## How to set affiliate parameters?

In main api, it's enough to pass affiliate parameters only in routing methods e.g. in [getBestRoute](/api-integration/main-api-multi-step/api-reference/get-best-route.md) or `getAllRoutes` methods.

In these methods, several fields could be used for participating in the affiliate program: `affiliateRef`, `affiliateWallets`, `affiliatePercent`. You could use combination of`affiliateRef` 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:

{% tabs %}
{% tab title="Typescript" %}

<pre class="language-typescript"><code class="lang-typescript">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,
<strong>    checkPrerequisites: false,
</strong><strong>    affiliatePercent: 0.3,
</strong><strong>    affiliateWallets: {
</strong><strong>        "BSC": "0x6f33bb1763eebead07cf8815a62fcd7b30311fa3"
</strong><strong>    },
</strong>})
</code></pre>

{% endtab %}

{% tab title="cURL" %}

```bash
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
}
'
```

{% endtab %}
{% endtabs %}

Example code for the moment the user confirms the route:

{% tabs %}
{% tab title="Typescript" %}

<pre class="language-typescript"><code class="lang-typescript">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,
<strong>    checkPrerequisites: true,
</strong><strong>    selectedWallets: {
</strong><strong>        "BSC": "0xeae6d42093eae057e770010ffd6f4445f7956613",
</strong><strong>        "AVAX_CCHAIN": "0xeae6d42093eae057e770010ffd6f4445f7956613",
</strong><strong>    },
</strong><strong>    affiliatePercent: 0.3,
</strong><strong>    affiliateWallets: {
</strong><strong>        "BSC": "0x6f33bb1763eebead07cf8815a62fcd7b30311fa3"
</strong><strong>    },
</strong>})
</code></pre>

{% endtab %}

{% tab title="cURL" %}

```bash
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
}
'
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rango.exchange/api-integration/main-api-multi-step/monetization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
