What is Fee Sponsorship?
Fee Sponsorship allows you to cover the destination chain fees for your users’ Relay transactions. By sponsoring these fees, you can reduce costs for your users and create a more seamless experience. This is particularly valuable for onboarding new users or providing a premium experience for your application.Fee sponsorship covers all destination chain fees (including gas topup amounts), but not the origin chain gas fee. Users will still need to pay the gas required to submit their transaction on the origin chain.
Requirements
Before you can sponsor transactions, you need:- An API key — Required to authenticate your sponsorship requests and associate them with your app balance. Request an API key.
- Enterprise Partnership — Reach out to the Relay team to become an Enterprise Partner. Learn more about the Enterprise Partner Program.
- A Linked Funding Address — A wallet address must be linked to your API key. This is the address that will fund your app balance. Reach out to the relay team to link your wallet address.
- Sufficient App Balance — Your app balance must have enough funds to cover the fees you wish to sponsor.
Funding Your App Balance
There are two ways to deposit funds to your app balance:Option 1: Use the Relay App UI
The simplest way to deposit funds is through the Relay App Balance UI. This provides a user-friendly interface for managing your balance.Option 2: Direct On-Chain Deposit
You can programmatically deposit to your app balance by sending a transaction on Base to the Relay solver. This method involves appending specific calldata in place of the request ID to identify the deposit.How It Works
When you transfer funds to the solver using specific calldata, Relay treats it as a deposit to your app balance. This method uses a fixed 12-character prefix and suffix (012345abcdef) with the middle portion specifying which address to credit:
Calldata Format:
- Prefix:
012345abcdef - Address to Credit: The wallet address to deposit funds for (use
0000000000000000000000000000000000000000formsg.sender) - Suffix:
012345abcdef
Examples
Solver Address
Deposits should be sent to the Relay solver on Base:TypeScript Example
Checking Your App Balance
Verify your available balance using the Get App Fee Balances API:Sponsoring Transactions
Once your app balance is funded, you can sponsor transactions by including specific parameters in your quote requests.Required Header
Sponsorship Parameters
Add these parameters to your Get Quote API request:Example Request
cURL
x-api-keyheader authenticates your sponsorship requestsubsidizeFees: trueenables fee sponsorshipmaxSubsidizationAmount: "5000000"caps sponsorship at $5.00 USDC
How maxSubsidizationAmount Works
The maxSubsidizationAmount parameter acts as a spending cap for fee sponsorship:
- If the total fees are at or below this amount, the sponsor covers the full cost
- If the total fees exceed this amount, the sponsor pays up to the cap and the user pays the remainder
With partial fee sponsorship, users always receive some benefit from your sponsorship even when fees spike. For example, if you set a 7.00, you pay 2.00.
Solana Fee Sponsorship
Solana transactions involve unique cost structures that differ from EVM chains. In addition to standard transaction fees, Solana requires rent payments for creating new accounts, such as Associated Token Accounts (ATAs). Relay provides specific parameters to handle these costs.Understanding Solana Rent
When a user receives a token on Solana for the first time, an Associated Token Account must be created to hold that token. This account creation requires a rent payment (approximately 0.002 SOL). Without sponsorship, this cost falls on the user.Sponsoring Destination Rent with subsidizeRent
The subsidizeRent parameter allows you to sponsor the rent fees for ATA creation on Solana destination transactions.
Important considerations:
- When
subsidizeFeesis enabled butsubsidizeRentis not, requests involving ATA creation will automatically fall back to user-paid fees. This is because rent sponsorship without explicit opt-in presents an exploitation vector. - The exploitation risk stems from the fact that users can close their ATA after the transaction completes and reclaim the rent. This effectively converts sponsored rent into a direct transfer of funds to the user.
- Only enable
subsidizeRentwhen you have a trusted relationship with your users or have implemented safeguards against abuse.
Example Request
cURL
subsidizeFees and subsidizeRent are enabled, ensuring the sponsor covers all destination fees including any ATA rent required for the recipient to receive USDC on Solana.
Sponsoring Origin Deposits with depositFeePayer
For transactions originating from Solana, you can designate an alternative account to pay the transaction fees and rent for the deposit transaction using depositFeePayer.
The
depositFeePayer parameter operates independently from the subsidizeFees and subsidizeRent parameters. It applies specifically to Solana origin transactions and does not draw from your app balance.depositFeePayer:
- When you want to provide a gasless experience for users depositing from Solana
- When your application maintains a dedicated fee-paying wallet for Solana transactions
- When you want to abstract away the complexity of SOL requirements from your users
Example Request
cURL
depositFeePayer address will cover the Solana transaction fees for the deposit, allowing the user to transact without holding SOL.
Solana Sponsorship Summary
What Fee Sponsorship Does Not Cover
Fee sponsorship is designed to cover relay and execution costs, but certain fees remain outside its scope:- Origin chain gas fees — Users must pay the gas required to submit their transaction on the origin chain (unless using
depositFeePayerfor Solana origins). - App fees — Fees configured via the
appFeesparameter are not deducted from your sponsor balance. These are separate charges that accrue to the specified recipient addresses. - First-time approval transactions when using
usePermit— The initial approval transaction required for permit-based flows is not covered by fee sponsorship. However, all subsequent requests after the approval will be sponsored.
Fees Object
When you sponsor transactions, the quote response includes afees object with a subsidized field showing the fees covered by your sponsorship:
Best Practices
- Monitor Your Balance — Set up alerts or automated checks to ensure your app balance doesn’t run dry during high-traffic periods.
-
Use
maxSubsidizationAmount— Always set a reasonable cap to protect against unexpected fee spikes. - Consider Auto-Topup — For production applications, consider implementing an auto-topup system using the direct onchain deposit method.
- Track Sponsored Transactions — Use the Get Requests API to monitor your sponsored transaction history and costs.
Related Resources
- App Fees — Learn how to collect fees from your users
- Get App Fee Balances — API reference for checking balances
- Get Quote — API reference for quote requests
- Relay Fees — Understanding Relay’s fee structure
- Solana Support — Guide to depositing and withdrawing on Solana