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

# Fees

Two parties can charge fees on an order: Flashnet charges a platform fee, and you can add your own fees on top. This page owns who pays what, in which asset, and in what order.

## Platform fee

The platform fee is bps plus a minimum, set per partner and route. Pricing is contractual, so quote responses (`feeAmount`, `feeBps`) are the source of truth for your rate, not the docs.

It is charged on the input side for buys and the output side for sells. `feeAsset` is USDC on most routes, USDB on BTC to USDB, and BTC on direct Lightning passthrough routes.

Invoice-billing partners see `feeAmount: "0"` on quotes: their platform fees accrue instead of being deducted per transaction, and are billed monthly. Fees owed are visible at `GET /v1/partner/dashboard/fee-invoices`.

## LP pool fee

Routes that swap through the BTC/USDB pool on Spark also pay the pool's LP fee, charged in the input asset: BTC when selling, USDB when buying. It goes to liquidity providers, not Flashnet, and varies with pool depth and trade size. Like every other fee, it is already reflected in the quoted output; the user sends `amountIn` and receives `estimatedOut`.

## Your fees

Two mechanisms, mutually exclusive per quote. Sending both returns `400 invalid_request`.

**Inline (`appFees`)**: an array of `{recipient, fee}` on the quote, where `fee` is bps (`1` to `10000`). Max 16 entries, sum of bps at most 10000, and each recipient is validated against the settlement chain's address format. Use this when recipients vary per quote and you do not need accrual or claims.

**Registered (`affiliateIds`)**: recipients registered once via `PUT /v1/affiliates/:affiliateId` with `feeBps`, `payoutChain`, `payoutAsset`, and `payoutAddress` (ids match `^[a-z0-9][a-z0-9_-]{0,63}$`). Each quote entry is a plain id, or `{affiliateId, feeBps}` to override the profile rate for that quote only. The legacy single `affiliateId` field folds into `affiliateIds`. Use this when you want stable recipients, per-order accrual, and claim-based payouts.

Flashnet keeps 20% of every app and affiliate fee, surfaced as `appFeePlatformCutAmount`; the recipient gets 80%.

## Route scope

Fee plans work on any route with a resolvable fee settlement:

* Settlement is `solana:USDC` when either side is Solana or any EVM chain, when the destination is a NEAR-egress asset, or on TON and Monero routes.
* Settlement is `spark:USDB` when either side is `spark:USDB`.
* Pure BTC-to-BTC routes have no settlement asset and reject fee plans with `400 unsupported_fee_plan`.

## Deduction order

Fees come out in a fixed sequence before execution:

1. Platform fee (`feeAmount`)
2. Sweep fee (`sweepFeeAmount`, some USDC-source routes only)
3. App and affiliate fees (`appFeeAmount`)
4. Flashnet's 20% cut of those fees (`appFeePlatformCutAmount`)
5. The net amount executes

`totalFeeAmount` on a quote equals `feeAmount + roundingFeeAmount + appFeeAmount + sweepFeeAmount`. `roundingFeeAmount` is stablecoin surplus retained when output is capped to a whole-cent or exact-out target; it appears only when nonzero.

## A worked example

A \$1,000.00 USDC exact-in quote (`amount: "1000000000"`) with one affiliate at 100 bps. Assume a 5 bps platform fee for illustration; your contractual rate applies in practice.

| Step                                    | Amount     | Field                        |
| --------------------------------------- | ---------- | ---------------------------- |
| Input                                   | \$1,000.00 | `amountIn`                   |
| Platform fee (5 bps)                    | \$0.50     | `feeAmount`                  |
| Affiliate fee (100 bps)                 | \$10.00    | `appFeeAmount`               |
| Flashnet's 20% cut of the affiliate fee | \$2.00     | `appFeePlatformCutAmount`    |
| Affiliate accrues (80%)                 | \$8.00     | `appFees[0].recipientAmount` |
| Executes                                | \$989.50   |                              |

The user pays $10.50 in total fees. The affiliate's $8.00 accrues to their ledger; the remaining \$989.50 proceeds to route execution and determines `estimatedOut`.

## Affiliate payout lifecycle

Affiliate fees accrue per order into a ledger. `POST /v1/affiliates/:affiliateId/claim` takes the full available balance in one payout; the minimum claim is \$1.00 USD-normalized. The payout destination is frozen from the oldest unclaimed accrual, so rotating the profile's payout address never redirects fees that already accrued.

Discover valid payout destinations at `GET /v1/affiliate-dashboard/payout-destinations`. Affiliates can get read-only dashboard access without touching your server key: mint a client key with the `affiliates:read` scope pinned to their affiliate id. See [Affiliate Fees](/products/orchestration/api/resources) for registration and claim details.

## Client keys

Client keys (`fnp_`) cannot set any fee field. A client key can only apply its pinned affiliate, and it cannot claim or manage affiliates. Fee configuration always flows through your server key.

## Where to go next

* [Pricing](/products/orchestration/concepts/pricing) for how the quoted output is produced
* [Amounts](/products/orchestration/concepts/amounts) for units and amount modes
* [Quotes and Orders](/products/orchestration/api/quotes-and-orders) for fee fields on requests and responses
* [Order Lifecycle](/products/orchestration/order-lifecycle) for how fees appear on the order record
