The Fee Formula
platformFee = Math.max(feeFlat, paymentAmount × feePercent / 100)
netToMerchant = paymentAmount − platformFee − gasReimbursement
Default Fee Values
| Parameter | Default | Env Variable |
|---|---|---|
| Flat fee floor | $0.60 | SYSTEM_FEE_USDT |
| Percentage | 1% | fee_configs table |
| Gas reimbursement | Dynamic (PancakeSwap price) | — |
Worked Examples
| Payment | 1% of Payment | Fee Charged | Net to Merchant |
|---|---|---|---|
| $10.00 | $0.10 (below floor) | $0.60 | ~$9.35 |
| $60.00 | $0.60 (equals floor) | $0.60 | ~$59.35 |
| $500.00 | $5.00 (above floor) | $5.00 | ~$494.70 |
Gas reimbursement ≈ $0.25–$0.65 depending on network conditions.
Per-User Fee Overrides
High-volume merchants can negotiate custom rates. The fee_configs table stores per-user, per-network overrides:
INSERT INTO fee_configs (userId, network, feeFlat, feePercent)
VALUES (42, 'BSC', 0.40, 0.75);
The sweep service checks for a user-specific config before falling back to system defaults.
Gas Reimbursement Transparency
The actual BNB gas cost is fetched from the transaction receipt, converted to USDT at the current PancakeSwap V2 WBNB/USDT rate, and deducted at the exact conversion rate — no markup.