Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions features/app-fees.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
---
title: "App Fees"
description: "Add App Fees on any route and collect in stablecoins "
description: "Add your own fees to any Relay transaction and collect in stablecoins"
---

## What are App Fees?
App Fees let you monetize supported transactions without building separate fee collection and settlement infrastructure. Set a fee on each quote, and Relay collects it when the transaction settles. Fees accrue in a single USDC balance, regardless of the input token or chain. Claim your balance for free on Base whenever it is convenient.

App fees are additional fees set by third-party developers on top of existing fees. These fees are specified when generating a quote. To improve the gas costs of fee setting, App fees are not paid out in real-time. Rather, App Fees accrue in an offchain base _USDC,_ balance and can be withdrawn as desired at your convenience.
## How App Fees work

## Setting App Fees
1. **Set a fee** — Add one or more recipients and set a fee in basis points of the input value in the quote request.
2. **Complete the transaction** — Your user follows a normal Relay flow. Relay collects the fee at settlement.
3. **Collect fees** — Collected fees accrue to the recipient's USDC balance.
4. **Claim the balance** — Withdraw through the Relay API or SDK. Multisigs and smart contracts can claim through EIP-1271.

## Why use App Fees?

- **Control your pricing** — Set fees per quote and adjust them by product, customer, or promotion.
- **Collect at settlement** — Avoid separate invoices, payment collection, and settlement logic.
- **Simplify accounting** — Track one USDC balance instead of reconciling tokens across chains.

---

## Setting up App Fees

App Fees are measured in basis points (bps) based on the input value of an order. When setting an app fee, an EVM-based claim address must be provided, which will be used for withdrawing accumulated fees. A single quote can include multiple App fees. You can accrue fees by including `AppFees` in the Quote API:

Expand All @@ -20,7 +33,7 @@ App Fees are measured in basis points (bps) based on the input value of an order
]
```

### Additional Considerations
**Additional considerations**

- On same-chain operations where the solver holds neither the input or output currency, an extra swap is added within the transaction to swap from the input currency into a currency accepted by the solver for App Fees
- For this to occur, the fee to be taken needs to be greater than $0.025. This is to prevent the situation where the action of taking the app fee will consume more in gas than the fee itself.
Expand All @@ -29,10 +42,10 @@ App Fees are measured in basis points (bps) based on the input value of an order
- App fees work the same way with deposit address flows as with regular quote requests.

<Warning>
If you include the `appFees` parameter on an unsupported transaction type (such as sends, transfers, or gasless execution without a prior quote), the API will not return an error — but no fees will be collected. Always verify fee collection is working using the [monitoring endpoints](#verifying-fee-collection) described below.
If you include the `appFees` parameter on an unsupported transaction type (such as sends, transfers, or gasless execution without a prior quote), the API will not return an error — but no fees will be collected. Always verify fee collection using the verification endpoints described below.
</Warning>

## Supported Transaction Types
**Supported transaction types**

App fees are supported on the following transaction types:

Expand All @@ -47,15 +60,15 @@ App fees are supported on the following transaction types:
| Gasless swaps | ✅ Fees from original quote are respected |
| Gasless execution (no prior quote) | ❌ Same-chain only — e.g. 7702 wallet upgrades |

### Chain-Specific Notes
**Chain-specific notes**

**EVM (same-chain):** Fully supported. Fees can be collected from the input currency, the output currency, or via a parallel swap to USDC.

**SVM (same-chain):** Supported with input-currency collection only. Output-currency fee collection is not available — this applies to all output currencies, not just SOL. If the input currency is not a solver-held currency, the fee is collected via a secondary swap into USDC.

**Cross-chain (all combinations):** Fully supported. Same-chain limitations do not apply to cross-chain swaps — fees are calculated based on the solver's deposit currency on the origin chain.

## Verifying Fee Collection
**Verifying fee collection**

You can verify that app fees are being collected correctly using the following endpoints:

Expand All @@ -69,7 +82,7 @@ App balance accrue in USDC from app fees, and can be claimed on any chain. The b

The easiest way to claim your App Balance is to use the [Relay App](https://relay.link/claim-app-fees). The Relay App Balance page also supports withdrawing via a multisig. Here's how you can withdraw via the API:

### Get App Balance
**Get App Balance**

To check your accrued App Balance, use the App fee balances API. Here's an example curl command and response. The response includes the `balances.currency` field reflecting your off-chain balance for each currency accumulated.

Expand Down Expand Up @@ -101,7 +114,7 @@ curl --location 'https://api.relay.link/app-fees/0x03508bb71268bba25ecacc8f620e0

To learn more about this api, see the [Get App Fee Balance](/references/api/get-app-fee-balances) API reference.

### How to withdraw your off-chain balance?
**Withdraw your balance**

To withdraw your app fees, use the app fees claim API. If using the API, the response will guide you through signing and submitting a message to the `/execute/permit` endpoint to verify ownership of your claim address. The SDK automates this process for you.

Expand Down Expand Up @@ -179,7 +192,7 @@ curl -X POST \

Once done, you can check your balance again to verify the withdrawal. To learn more about this api, see the [Claim App Fee Balance](/references/api/claim-app-fees) API reference.

### Withdrawing via a smart contract
**Withdraw through a smart contract**

In some cases you may want to accrue fees into a smart contract instead of an EOA. This can easily be done by setting the app fees recipient. The challenge is in claiming the fees to the contract. The claim API requires a signature to claim app fees but contracts cannot sign messages. To solve this, the API supports [EIP-1271](https://eips.ethereum.org/EIPS/eip-1271) which allows a smart contract to validate a signature using arbitrary logic. Once implemented our backend will check if the contract implements `isValidSignature` and use that method to verify the signature.

Expand Down
Loading