You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/docs/pages/0x-swap-api/additional-topics/multi-fee-support.mdx
+40-34Lines changed: 40 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,15 @@ The Swap and Gasless APIs support collecting fees for **multiple recipients in a
7
7
8
8
## Overview
9
9
10
-
Both `swapFeeRecipient` and `swapFeeBps` accept **comma-separated lists**, allowing you to define multiple fee recipients, each with their own fee rate.
10
+
Fee splitting is controlled by three query parameters that work together:
11
11
12
-
Each fee is:
12
+
-`swapFeeRecipient` — one or more wallet addresses (comma-separated) that receive fees at settlement
13
+
-`swapFeeBps` — one or more fee amounts in basis points (comma-separated), defining how much each recipient earns
14
+
-`swapFeeToken`_(optional)_ — the token fees are collected in; if omitted, typically defaults to the buy token, unless the sell token has higher priority (e.g., stablecoins or more liquid assets) or the buy token is ineligible.
13
15
14
-
- Collected in the `swapFeeToken` (the buy token by default)
15
-
- Delivered directly to the specified recipient address
16
-
- Reported individually in the response under `fees.integratorFees`
16
+
`swapFeeRecipient` and `swapFeeBps` are positionally matched and co-dependent. The first value in `swapFeeBps` applies to the first address in `swapFeeRecipient`, the second to the second, and so on. Both must be present and the same length.
17
+
18
+
By default, each fee is collected in the buy token and delivered directly to the specified address at settlement. You can optionally collect fees in a different token by specifying `swapFeeToken`, as long as each value is set to either the address of the `buyToken` or `sellToken`.
17
19
18
20
## Parameters
19
21
@@ -35,16 +37,30 @@ When providing multiple values, the list must be the same length as `swapFeeReci
Each value must be set to either the address of the `buyToken` or the `sellToken`. When multiple values are provided, the list must be the same length as `swapFeeBps`.
46
+
47
+
If omitted, 0x selects the fee token from the trade. The buy token is used by default unless the sell token has higher priority (e.g., stablecoins or more liquid assets) or the buy token is ineligible.
48
+
49
+
You must also specify `swapFeeRecipient` and `swapFeeBps` to use this parameter.
50
+
51
+
</ParamField>
52
+
38
53
<Note>
39
54
`swapFeeRecipient` and `swapFeeBps` are co-dependent — you must specify both
40
55
together. When using multiple fees, both lists must be the same length and
41
56
positionally matched (index 0 of `swapFeeBps` applies to index 0 of
42
-
`swapFeeRecipient`, and so on).
57
+
`swapFeeRecipient`, and so on). `swapFeeToken` must also match this length
58
+
when multiple values are provided.
43
59
</Note>
44
60
45
61
## Example Request
46
62
47
-
The following examples split fees between two recipient addresses — 5 Bps to `0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045`and 10 Bps to `0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359`.
63
+
The following example splits fees between two recipients on a USDC → USDT swap — 5 Bps to the platform and 10 Bps to a distribution partner. `swapFeeToken` is omitted, so fees default to the buy token (USDT).
0 commit comments