> For the complete documentation index, see [llms.txt](https://docs.aqua.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aqua.network/developers/code-examples/add-fees-to-swap.md).

# Add fees to swap

Enable any Aquarius integrator to take a configurable commission on each swap—without mixing classic Stellar payments and Soroban calls in one transaction.

### Core features

* **Configurable Fee Fraction:** Specify the maximum fee allowed by the contract (for example, 2%), then set the fee amount for each individual swap for maximum flexibility.
* **Fee Destination:** Route collected fees into a single “fee destination” address of your choice.
* **Uniform Denomination:** Swap fees can be converted on claim into one target asset (for example, XLM, USDC, AQUA), so you aren’t left holding a basket of tokens.
* **Out‑of‑the‑Box Wrapper:** A standalone Soroban contract sits atop our Aquarius AMM Router. Call it instead of directly calling the router, and it handles fee deduction and forwarding for you.
* **Secure & Flexible:** Operators can claim raw fees or immediately swap them via predefined routes.

### Setup instructions

**1. Deploy a Fee Collector Smart Contract**

To begin collecting swap fees, deploy your custom fee collector smart contract. This contract stores core parameters such as:

* Fee destination address
* Maximum allowed fee
* Operator address (authorized to claim fees)

**2. Execute Swaps Using the Fee Collector**

Once deployed, the fee collector smart contract allows you to execute swaps similarly to regular Aquarius swaps, with the added capability to specify and collect fees.

**3. Claim Collected Fees**

At any time, the designated operator can invoke the claim method on the smart contract to transfer accumulated fees to the specified destination address.

Continue reading below for more detailed explanations of each step.
