💰Monetization / Take Fees
Integrate XY Finance API (Multiple Bridges Aggregator) to enable fee collection from transaction volumes in your dApp
How it works
By integrating XY Finance API to request transaction quotes, dApps can now include a fee parameter to specify the percentage of the transaction volume they wish to collect as fees. This percentage fee will be deducted from the user's initial asset in the transaction and directly distributed to the designated wallet address. XY Finance will receive a percentage share of the collected fees based on the specific use case and transaction volume.
How to set up
To configure the fee collection, there are two relevant parameters that you can adjust: affiliate
and commission rate
during the execution of Get Quote and Build Swap Transaction
commission rate
represents the fee you wish to collect. It is an integer between 0 and 100,000. In this range, 100,000 corresponds to 10%, 10,000 represents 1%, and so on in a similar fashion.affiliate
parameter represents the address where you want to receive the fees. The collected fee in every transaction will be directly transferred to this address. Before proceeding, please ensure that the provided address is under your management and capable of receiving assets correctly.
Below are examples demonstrating how to configure the fee setup.
API Example
Transaction example
Here is the link of the transaction where you can actually know how the affiliate fee is collected and distributed
In this case, the quote parameters are as follows:
commisionRate = 1000
it means the transaction will take 1000/1000000 = 0.1% as the affiliate fee.
srcQuoteTokenAmount = 10000000000000000
it represents 0.01 without decimals.
srcQouteTokenAddess = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
it represents as native token in our API
You can find the following process executed in this transaction:
XY router (0x062.....08c) will distribute 0.1 % of the volume as the affiliate fee (0.00001 ETH)
Transfer 0.000008 ETH to the designated affiliate address (0xBF.....362)
Transfer 0.000002 ETH to XY fee collector (0x46.....29d)
Last updated