This page covers how integrators can earn affiliate fees on swaps.
amount_out
it returns to the user. This ensures the quote you show the user already accounts for the fee, and they won’t receive any unexpectedly low amount./route
and /msgs
/route
and /msgs
endpoints, you can incorporate affiliate fees by specifying the total fee during the /route
request and detailing the fee recipients during the /msgs
request. Below is a comprehensive guide on how to correctly implement this.
/route
Request/route
request, include the cumulative_affiliate_fee_bps
parameter to specify the total fee you wish to collect, expressed in basis points (bps).
cumulative_affiliate_fee_bps
to "75"
.@skip-go/client
, use camelCase: cumulativeAffiliateFeeBps
./route
request, use the swap_venue.chain_id
field in the response to determine which chain the swap will occur on. You’ll need this information to provide valid recipient addresses in the next step.
/msgs
Request/msgs
request, define the chainIdsToAffiliates
object to allocate fees to specific addresses on the relevant chains.
basisPointsFee
values across all affiliates on the swap chain must equal the cumulative_affiliate_fee_bps
set in the /route
request.400
error.@skip-go/client
, remember to use camelCase (e.g., basisPointsFee
) in the config./msgs_direct
/route
and /msgs
over /msgs_direct
due to the added complexity when handling fees with /msgs_direct
./msgs_direct
endpoint, you need to specify affiliate fees for every possible chain the swap might occur on since the swap chain is determined during the request.
chainIdsToAffiliates
for All Potential Swap Chains
chainIdsToAffiliates
object to map each potential chain_id
to its corresponding affiliates.chain_id
, provide a list of affiliates
, each with:
basisPointsFee
: The fee amount in basis points (bps).address
: The recipient’s address on that chain./v2/fungible/swap_venues
endpoint.chainIdsToAffiliates
for each chain_id
from the list.basisPointsFee
values for affiliates on each chain must be equal across all chains.