> For the complete documentation index, see [llms.txt](https://docs.peach.ag/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.peach.ag/documentation/arc/aggregator/core-features/custom-fee-and-slippage.md).

# Fees

Configure integrator fees, calculate net recipient output, and distinguish custom fees from trading fees and gas.

### Configuration

| SDK parameter       | Rules                                                                                               |
| ------------------- | --------------------------------------------------------------------------------------------------- |
| `customFeeBps`      | Integer bps; omitted means zero. SDK allows 0–10000, but the active API/router cap is usually lower |
| `customFeeReceiver` | Required for a positive fee; non-zero and different from recipient and Execution Router             |

Read `new ApiClient(apiOptions).getStatus()` using the same API options as your `ArcClient` for `arc_router.max_custom_fee_bps` and the protocol-cut policy. On 2026-09-07 the endpoint reported a 500 bps custom-fee cap and a 2000 bps protocol cut. These are a dated snapshot, not permanent constants. Both the server and contract enforce policy. An accepted SDK value can still be rejected by the deployment.

A zero custom fee normalizes the receiver to the zero address. Use the prepared result to inspect the normalized terms.

### What the user pays

| Cost                              | Treatment                                                               |
| --------------------------------- | ----------------------------------------------------------------------- |
| Pool, curve and Hook trading fees | Already reflected in route output                                       |
| Aggregator custom fee             | Deducted from route output in the output token                          |
| Protocol cut                      | Allocated from the custom fee, not deducted again from recipient output |
| Network gas                       | Paid separately by the transaction sender                               |

Choose and display fee terms before confirmation. A fee change invalidates that confirmation.

### Calculation order

```
grossOutput       = route output after underlying trading fees
customFee         = floor(grossOutput * customFeeBps / 10000)
expectedNetOutput = grossOutput - customFee
protocolCut      = floor(customFee * protocolCutBps / 10000)
integratorFee    = customFee - protocolCut
```

| Example, in output-token base units      | Amount |
| ---------------------------------------- | ------ |
| Gross output                             | 1003   |
| Custom fee, 333 bps                      | 33     |
| Expected recipient output                | 970    |
| Protocol cut, 2000 bps of the custom fee | 6      |
| Integrator receives                      | 27     |

Each division uses integer floor rounding. Calculate with `bigint` and display with the output token's decimals. Do not round a human-readable decimal and then convert back to token units.

After calculating net output, apply the user’s tolerance as explained in [Slippage](https://docs.peach.ag/documentation/arc/aggregator/core-features/slippage). Slippage tolerance is not a fee. Network gas is paid separately by the transaction sender.

### Read and display the result

`swap()` accepts `customFeeBps` and `customFeeReceiver` in the same request that returns the quote and transaction. Display its net output, fee terms and signed minimum before confirmation. The same fee fields apply to `prepareDelegatedSwap()`. See [Slippage](https://docs.peach.ag/documentation/arc/aggregator/core-features/slippage) for retaining and enforcing the minimum net output.

* Direct response `amount_out` is the route output before aggregator custom fee.
* `expect_amount_out` / SDK `expectAmountOut` is the expected net output.
* Direct responses additionally report `custom_fee_amount`, `protocol_fee_amount`, `integrator_fee_amount` and `protocol_cut_bps`.
* Actual settlement can differ from the quote. Show confirmed execution amounts after the transaction succeeds. Positive-output capture, if enabled by router policy, is a separate settlement policy; the documented live snapshot reports zero capture.

### Hook fees versus custom fees

A V4 Hook fee is collected by the pool's Hook during the swap. It is already reflected in the route's output. The aggregator custom fee is then calculated on the resulting output. Do not subtract either fee twice when displaying expected proceeds.

Hook Partner attribution shares part of the Hook's protocol allocation; it does not set the aggregator custom-fee receiver. The current aggregator V4 adapter passes empty `hookData`, so setting a custom fee does not attribute a Hook Partner. See [Partner and hookData](https://docs.peach.ag/documentation/arc/launchpad/core-features/uniswap-v4-hooks/partner-and-hookdata).

### Supported amount mode

Custom fees apply to the output of a fixed-input swap. See [Quotes and Routing](https://docs.peach.ag/documentation/arc/aggregator/core-features/quotes-and-routing#amount-direction) for supported amounts.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.peach.ag/documentation/arc/aggregator/core-features/custom-fee-and-slippage.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
