Introduction
The deBridge DLN API allows you to earn affiliate fees on cross-chain bridge orders by including your affiliate parameters in order creation. When you create an order with affiliate fee settings, you receive a percentage of the transaction fees as commission.How Affiliate Fees Work
When you create a bridge order with affiliate fee parameters, the deBridge protocol:- Collects the affiliate fee percentage from the transaction
- Credits it to your specified affiliate fee recipient address on the source chain
- Holds the fee in an escrow state until the order is fulfilled
- Makes the fee available for withdrawal once the order reaches
ClaimedUnlockstate
Key Parameters
To earn affiliate fees on your orders, you need to include these parameters:affiliateFeePercent
The percentage of the transaction fee you’ll receive as an affiliate. Expressed as a whole number (e.g.,
10 for 10%).Note: Both affiliateFeePercent and affiliateFeeRecipient must be set together. If either is missing or set to 0, neither will be applied.affiliateFeeRecipient
The wallet address that will receive the affiliate fees. This address receives fees on the source chain.Must be a valid address format for the source chain (EVM address for EVM chains, Solana address for Solana).
referralCode
An optional numeric identifier to track orders associated with your integration. Use this to query and monitor your affiliate orders.You can later filter orders by this code using the deBridge Stats API.
Affiliate Fee Lifecycle
Create Order with Affiliate Parameters
Include
affiliateFeePercent, affiliateFeeRecipient, and optionally referralCode when creating your bridge order.Order Execution
The order is created on-chain and the affiliate fee is reserved in the order’s escrow wallet.
Order Fulfillment
Once the order is fulfilled and reaches
ClaimedUnlock state, your affiliate fees become available for withdrawal.Querying Your Affiliate Orders
You can query orders by referral code or affiliate recipient address using the deBridge Stats API:Withdrawing Affiliate Fees
Affiliate fees accumulate in order escrow wallets on the source chain. To claim your fees:- Query for orders in
ClaimedUnlockstate with your affiliate address - Build withdrawal instructions for each order
- Execute a batch withdrawal transaction
Best Practices
Use a consistent referral code
Use a consistent referral code
Choose a unique referral code for your integration and use it consistently across all orders. This makes tracking and analytics much easier.
Set reasonable fee percentages
Set reasonable fee percentages
While you can technically set high affiliate fees, consider your users’ experience. A typical affiliate fee is between 0.1% and 2% of the transaction.
Batch your withdrawals
Batch your withdrawals
Instead of withdrawing fees after each order, accumulate fees from multiple orders and withdraw them in batches to save on gas costs.
Monitor order states
Monitor order states
Keep track of your orders’ states. Fees are only withdrawable once orders reach
ClaimedUnlock state.Next Steps
Create Order with Affiliate Fees
Learn how to create a bridge order with affiliate fee parameters
Batch Withdraw Fees
Implement batch withdrawal to claim your accumulated affiliate fees