0

I would Like to charge commission/fee on every DEX transaction using 0x API; i am calling GET /swap/v1/quote

with adding feeRecipient & buyTokenPercentageFee but when a user does a tranx via the API on our UI platform; we are NOT getting any fee.

Should i be using any other API in combination to above? or ...

Query string:

https://bsc.api.0x.org/swap/v1/quote?sellToken=BNB&buyToken=DAI&buyAmount=10000000000000000&feeRecipient=0x4519dE0a438aaBBD56f1f268F60325c85250062B&takerAddress=0x4519dE0a438aaBBD56f1f268F60325c85250062B&buyTokenPercentageFee=0.15

Please let me know

2 Answers 2

0

Looks like you have feeRecipient set to the same address as the takerAddress. This means 0x4519dE0a438aaBBD56f1f268F60325c85250062B is effectively paying themselves the commission.

2
  • Hey; i just entered this query string hastily; during tranx takerAddress != feeRecipient and the feeRecipient still doesnt receive anything I hope the query string is enough right? no other API needs to be called? Commented Nov 4, 2021 at 5:31
  • In that case the query looks correct, no other API is necessary. Do you have an example transaction?
    – mzhu25
    Commented Nov 4, 2021 at 18:28
0

You'll note that the parameter that controls the affiliate fee is called 'buyTokenPercentageFee' in the 0x docs. This is the percentage fee taken from the buyAmount. In your query, you are specifying a buyAmount (i.e. exact output swap) which 0x does not currently apply the affiliate fee to. This is why you do not receive any tokens on the feeRecipient address.

While this is a late answer to an old post, I hope it helps someone down the line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.