Great news!
You can now receive commission for each Bancor conversion that originates from your app, wallet or payment gateway.
The guide below will cover how to add Bancor's affiliate fees using the Bancor API.
To add affiliate fees in code, see "affiliate fee" in the Bancor Convert API, or integrate affiliate fees directly on the blockchain, using Bancor's blockchain conversion widget or in code by calling Bancor's quickConvert function.
Need help? Bancor core and community developers are always available on the Bancor Developers Telegram channel: https://t.me/BancorDevelopers
Here's how to add Bancor's affiliate fees using the Bancor API:
Step 1 -
Checking the conversion rate of the desired token swap.
Using the Value API, you should pull the relevant conversion rate of the token the user wish to convert.
Step 2 -
On the value received from the Value API, make sure you reduce the affiliate fee you wish to later on append to the transaction. For example, if you wish to take 1%, make sure you deduct 1% from the result of the Value API call.
Step 3 -
When the user decides to proceed with the conversion, you will now call the Convert API.
Make sure you update the call and append the following values:
- affiliateFee - the fee you wish to take from the transaction as an affiliate. Value should be passed as a decimal between 0-3.0000. For example, pass 1.5 if the fee is set to 1.5%.
- affiliateAccount - the recipient account that collects the affiliate fee from the transaction. Currently we support an Ethereum wallet address in this field. Please pass a valid Ethereum wallet. You will see an error if the wallet format is not valid.
IMPORTANT - make sure you update your minimum return calculation as well to use the updated value minus the fee. As the fee is deducted from the transaction, passing the original value will most likely result in the transaction to fail as the minimum return amount will be greater than the amount received.
Need help integrating? Bancor’s core and community developers are available to assist 24/7 on the Bancor Developer’s Telegram Channel: https://t.me/BancorDevelopers
Basic URL format:
(POST) https://api.bancor.network/0.1/transactions/convert
Sample Ethereum convert:
{
"fromCurrencyId": "5c9a078447a87f2e3cf10787",
"toCurrencyId": "5c9a078447a87f2e3cf107dc",
"amount": "1.0",
"minimumReturn": "1.28353582031457",
"ownerAddress": "0xfe3cff57b8c01b3ec244e4f62fee038eb94214af",
"format": "json"
"affiliateFee": "1.5",
"affiliateAccount":"0x5f7a009664B771E889751f4FD721aDc439033ECD"
}
Step 4 -
Check your wallet address occasionally to confirm BNT was sent to it for every successful transaction.
Need help integrating? Bancor’s core and community developers are available to assist 24/7 on the Bancor Developer’s Telegram Channel: https://t.me/BancorDevelopers