> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bungee.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Charging fees

> How to implement fee charging in Bungee integrations

# Charging Fees with Bungee

Bungee allows integrators to charge fees on swaps and transfers, providing a revenue stream for your application. This guide explains how to implement fee charging in both Bungee Auto and Bungee Manual integrations.

If you plan to implement fee charging, please request a dedicated API key first.

## Fee Mechanics

When integrating Bungee, you can specify two key parameters to collect fees:

* **`feeTakerAddress`**: The address that will receive the collected fees
* **`feeBps`**: The percentage of the transfer amount to charge as a fee (in basis points - 1 basis point = 0.01%)

These parameters ensure that a portion of each swap is directed to your specified feeTaker address. The input token amount will be reduced by the fee amount before the swap is executed.

## Implementation

You can add fee parameters to both Bungee Auto and Manual integrations when requesting a quote:

```javascript theme={null}
const BUNGEE_API_BASE_URL = "https://public-backend.bungee.exchange";

async function getQuoteWithFees() {
  const quoteParams = {
    userAddress: "0xYourUsersAddress",
    originChainId: "1", // Ethereum
    destinationChainId: "10", // Optimism
    inputToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
    outputToken: "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", // USDC on Optimism
    inputAmount: "1000000", // 1 USDC (6 decimals)
    receiverAddress: "0xYourUsersAddress",
    feeTakerAddress: "0xYourFeeCollectionAddress", // Address to receive fees
    feeBps: "50", // 0.5% fee (50 basis points)
  };

  // For Manual mode, add this parameter
  // quoteParams.enableManual = "true";

  const url = `${BUNGEE_API_BASE_URL}/api/v1/bungee/quote`;
  const queryParams = new URLSearchParams(quoteParams);
  const fullUrl = `${url}?${queryParams}`;

  const response = await fetch(fullUrl, { method: "GET" });
  const data = await response.json();
  const serverReqId = response.headers.get("server-req-id");

  if (!data.success) {
    throw new Error(
      `Quote error: ${data.statusCode}: ${data.message}. server-req-id: ${serverReqId}`
    );
  }

  return data.result;
}
```

## Where to Claim Fees

For Bungee Manual, no need to claim as fees are delivered directly to the `feeTakerAddress` provided.

For Bungee Auto, fees are sent to the `FeeCollector` contract where anyone can trigger the claim fees for a specified token address and `feeTakerAddress` pair.

For per-chain `FeeCollector` addresses, see the [Contract Addresses](/integrate/contract-addresses) page. The `FeeCollector` exposes a `claim(address token, address feeTaker)` method to withdraw accrued fees.

## Next Steps

<CardGroup cols={2}>
  <Card title="Auto Integration Guide" href="/integrate/integration-guides/auto-erc20-permit2">
    Integrate Bungee Auto with fee charging
  </Card>

  <Card title="Manual Integration Guide" href="/integrate/integration-guides/manual">
    Integrate Bungee Manual with fee charging
  </Card>

  <Card title="Quote API Reference" href="/api-reference/core-api/get-bungee-quote">
    Details on the Quote API parameters
  </Card>

  <Card title="Fees & Monetization" href="/overview/fees-monetization">
    Learn more about fee charging and monetization
  </Card>
</CardGroup>
