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

# Charging Fees

> How to implement fee charging in Socket integrations

Socket allows integrators to charge fees on swaps and transfers, providing a revenue stream for your application. This guide explains how to implement fee charging.

If you plan to implement fee charging, please [request API access](/integrate/get-api-access) first. Swap V3 authentication and access controls are still being finalized.

## Fee Mechanics

When integrating Socket, 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 fee taker address. The client-facing output amount is already net of applicable fees.

## Rules

* `feeBps` and `feeTakerAddress` must be provided together.
* `feeBps` must be greater than `0` and at most `10000` (100%).
* For direct DEX routes, fees can be taken from input or output depending on the OpenRouter fee resolution.
* For direct bridge no-swap routes, fees are forced to the input side.

## Implementation

Add fee parameters when requesting a quote from `/v3/swap/quote`:

```bash theme={null}
curl -G "https://dedicated-backend.socket.tech/v3/swap/quote" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "affiliate: YOUR_AFFILIATE_ID" \
  --data-urlencode "userOps=tx" \
  --data-urlencode "originChainId=1" \
  --data-urlencode "destinationChainId=10" \
  --data-urlencode "inputToken=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" \
  --data-urlencode "outputToken=0x7F5c764cBc14f9669B88837ca1490cCa17c31607" \
  --data-urlencode "inputAmount=1000000" \
  --data-urlencode "userAddress=0xYourUsersAddress" \
  --data-urlencode "receiverAddress=0xYourUsersAddress" \
  --data-urlencode "feeTakerAddress=0xYourFeeCollectionAddress" \
  --data-urlencode "feeBps=50"
```

```javascript theme={null}
const SOCKET_API_BASE_URL = "https://dedicated-backend.socket.tech";
const SOCKET_AFFILIATE_ID = "YOUR_AFFILIATE_ID";

async function getQuoteWithFees() {
  const quoteParams = {
    userOps: "tx",
    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",
    feeBps: "50", // 0.5% fee (50 basis points)
  };

  const url = `${SOCKET_API_BASE_URL}/v3/swap/quote`;
  const queryParams = new URLSearchParams(quoteParams);
  const fullUrl = `${url}?${queryParams}`;

  const response = await fetch(fullUrl, {
    headers: {
      affiliate: SOCKET_AFFILIATE_ID,
    },
  });
  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 the Socket Swap V3 API (OpenRouter routes), fees are delivered according to the OpenRouter fee resolution — either from the input side or output side depending on the route type.

For legacy Bungee Auto routes, fees are sent to the `FeeCollector` contract where anyone can trigger the claim for a specified token address and `feeTakerAddress` pair. The `FeeCollector` exposes a `claim(address token, address feeTaker)` method to withdraw accrued fees.

## Next Steps

<CardGroup cols={2}>
  <Card title="API Integration Guide" href="/integrate/integration-guides/socket-api">
    Integrate Socket with fee charging
  </Card>

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

  <Card title="Get API Access" href="/integrate/get-api-access">
    Request API access
  </Card>

  <Card title="Contract Addresses" href="/integrate/contract-addresses">
    Find Socket contract addresses
  </Card>
</CardGroup>
