# Partner fees

How to add your own fee to a Maxy quote: the parameters, what the quote and the order carry, the SDK names and the errors. It is for routers, wallets and apps that earn on a Maxy route. Why Maxy takes no cut: [Fees and pricing](https://maxy.co/docs/fees-and-pricing#partner-fees).

## The parameters

| Parameter | Meaning |
| --- | --- |
| `partnerFeeBps` | Your fee in basis points of the trade: an integer from 0 to 100, default 0 |
| `partnerFeeRecipient` | The EVM address that receives it, on the chain the user pays from. Required when the rate is above 0 |
| `partnerFeeToken` | Optional. The coin the user pays with (the default), or a dollar stablecoin on that chain (USDC, USDT, USDG), counted at the quote's dollar price |

Send them on `GET /price`, `GET /quote`, each item of `POST /quotes/batch` and `POST /orders`. The fee is signed into the quote, and `POST /orders` must match it: a different fee is refused with `invalid_partner_fee`.

The sample uses the setup from [Get a quote](https://maxy.co/docs/buy-btc#get-a-quote) (`BASE`, `MAXY_API_KEY`, `WALLET`, `MY_BTC_ADDRESS`), and your fee address, `FEE_ADDRESS`: your EVM address on the chain the user pays from.

```sh
export FEE_ADDRESS=0x…
curl -s -G -H "x-maxy-key: $MAXY_API_KEY" "$BASE/quote" --data-urlencode "from=ETH on base" -d to=BTC -d amount=0.03 \
  -d fromAddress="$WALLET" -d toAddress="$MY_BTC_ADDRESS" -d partnerFeeBps=25 -d partnerFeeRecipient="$FEE_ADDRESS"
```

## What the quote shows

The fee is its own line: `fees.partner`, with `bps`, `amount` (in the fee coin's smallest unit), `token` (the zero address for the chain's own coin), `symbol`, `decimals`, `recipient`, `chainId`, `included` (`false`: on top of `fromAmount`), `paidBy` (`wallet`, or `solver` on `evm-btc-gasless`) and `refundable` (`false` when the fee is sent whatever happens to the order; `true` when it is paid only as the order fills: inside the solver's commit, or out of a two-leg sale's payout), `totalFromAmount`, what the wallet sends in all, and `formatted.partnerFee`. `toAmount` is unchanged, and so are the intent the user signs and the escrow. A real sandbox answer, trimmed (`x-request-id` 65866c78-0913-46b6-9138-318711c5a225):

```json
{
  "route": "evm-btc-escrow",
  "fromAmount": "30000000000000000",
  "toAmount": "83756",
  "toAmountMin": "83756",
  "totalFromAmount": "30075000000000000",
  "fees": {
    "partner": {
      "bps": 25,
      "amount": "75000000000000",
      "token": "0x0000000000000000000000000000000000000000",
      "symbol": "ETH",
      "decimals": 18,
      "recipient": "0x2222222222222222222222222222222222222222",
      "chainId": 8453,
      "included": false
    }
  },
  "formatted": {
    "send": "0.03 ETH on Base",
    "receive": "0.00083756 BTC",
    "partnerFee": "0.000075 ETH (25 bps)",
    "total": "0.030075 ETH"
  },
  "steps": [
    {
      "id": "intent",
      "kind": "signature"
    },
    {
      "id": "order",
      "kind": "post"
    },
    {
      "id": "escrow",
      "kind": "transaction"
    },
    {
      "id": "partnerFee",
      "kind": "transaction"
    }
  ]
}
```

## What the wallet sends

The order's steps add a `partnerFee` transaction: a separate transfer from the user's wallet straight to your address, the chain's own coin or an ERC-20 transfer, sent right after the escrow. `POST /orders` answers it as `partnerFee.transaction`; in the sandbox that transaction goes nowhere, and `partnerFee.wouldSend` holds the one a live key gets. It is paid when it is sent, so it stays paid if the order is later refunded. On `evm-btc-gasless` the solver sends the fee inside its commit, so an order no solver commits pays no fee (`refundable: true`). Nothing passes through Maxy. On `evm-btc-bridge` it is in the coin the user pays with, at its own decimals, sent beside the swap leg. On a BTC sale paid out through a bridge it comes out of the settler's payout (`included: true`, `toAmount` already after it), and `GET /orders/{id}/bridge` returns its transaction beside the bridge.

## In the SDK

Pass `partnerFee: { bps, recipient, token? }` to `swap.price`, `swap.quote` and `swap.execute`; `createOrder` and `execute` send the fee after the escrow, or beside the swap leg on `evm-btc-bridge`. The REST client's `prices.get` and `quotes.get` take `partnerFeeBps`, `partnerFeeRecipient` and `partnerFeeToken`. Python takes `partner_fee_bps`, `partner_fee_recipient` and `partner_fee_token`.

## Routes and errors

Partner fees run on `evm-btc-escrow`, `evm-btc-bridge`, two-leg `btc-evm` sales and `evm-btc-gasless`. On `evm-btc-escrow` and `evm-btc-bridge` the user's wallet sends the fee beside its own transaction; on `evm-btc-gasless` the user signs it and the solver that commits sends it inside its commit; on a two-leg sale it comes out of the payout. On a one-leg `btc-evm` sale, `sol-btc`, `btc-sol`, `cross-evm`, `chain-swap` and `sol-swap` there is nothing to send it beside, and the quote answers `400 partner_fee_unsupported_route`. `GET /config` lists the same routes in `partnerFee.routes`.

| HTTP | `code` | When |
| --- | --- | --- |
| 400 | `invalid_partner_fee` | `partnerFeeBps` outside 0 to 100; a recipient missing, malformed or the zero address; a token that is neither the paying coin nor a dollar stablecoin; or a `POST /orders` fee that differs from the quote's |
| 400 | `partner_fee_unsupported_route` | A fee on a one-leg `btc-evm` sale, `sol-btc`, `btc-sol`, `cross-evm`, `chain-swap` and `sol-swap` |

Neither is retryable as sent. `GET /statements` shows each order's partner fee on its own line: [Order states](https://maxy.co/docs/order-states#reconcile).

## A slashed order

A solver that commits and does not pay in time is slashed: the escrow returns to the refund recipient ([When it fails](https://maxy.co/docs/when-it-fails)). The settler never holds the partner fee, so a slash does not return it. The order reads `refunded`, and `GET /statements` keeps its fee line.

---
Source: https://maxy.co/docs/partner-fees (Maxy Docs › Learn about Maxy › Learn more)
