Skip to main content

Tariffs and Fees

TrexWallet uses a flexible, multi-dimensional tariff system to configure fees, limits, and service conditions for every type of financial operation. Tariffs control how much users pay for transfers, exchanges, withdrawals, and other operations.

How Tariff Matching Works

When a transaction is processed, TrexWallet finds the best matching tariff by checking the configured dimensions simultaneously:

DimensionDescriptionExample
tx_typeTransaction typeInnerTransfer, Exchange, Swap, Outcome
from_wallet_grSender's wallet group (bitmask, 0 = any)Premium users (group bit 3)
to_wallet_grRecipient's wallet group (bitmask, 0 = any)Merchant wallets (group bit 5)
curRule currency code (empty = any)USDT, BTC, EUR
networkTerminal id (0 = any)1, 2
crm_id_fromSender CRM identity (0 = any)Specific user
crm_id_toRecipient CRM identity (0 = any)Specific merchant
agent_idAgent/referral id (0 = any)Partner commissions
app_idMerchant application id (0 = any)Per-merchant tariffs
project_from / project_toProject filter on sender/recipientMulti-project deployments
min/max_amountAmount boundariesDifferent fees per amount band

Priority-Based Selection

Tariffs are sorted by priority (descending). The first matching tariff wins. This allows you to create:

  • General rules (low priority) — apply to all users by default
  • Specific rules (high priority) — override for certain currencies, user groups, or amounts
Priority 100: BTC withdrawal for Premium users → 0.1% fee
Priority 50: BTC withdrawal for all users → 0.5% fee
Priority 10: Any withdrawal → 1% fee (catch-all)

A Premium user withdrawing BTC matches priority 100 first. A regular user withdrawing ETH falls through to priority 10.

Wallet Groups

Users are assigned to wallet groups (0–63) that act as user tiers. Groups are encoded as bitmask flags, allowing a single tariff to match multiple groups simultaneously.

Common group assignments:

  • Group 0 — Default (all new users)
  • Group 1 — Verified users
  • Group 2 — Premium/VIP
  • Group 3 — Merchants
  • Group 4 — Agents/partners

Fee Types

Each tariff defines up to three fee components:

Fee TypeFieldDescription
Percent feepercent_feePercentage of the transaction amount (e.g., 0.5%)
Fixed feefeeFixed amount in the transaction currency (e.g., 1.00 USDT)
Network feeUseNetFee flagMaterializes the terminal network fee into the tariff's fixed fee

The applied fee is amount × percent_fee + fixed_fee. With UseNetFee, the fixed fee is set to terminal network fee × tariff rate; an empty or zero rate is treated as 1.

Special Fee Scenarios

  • Exchange operations use two tariffs: one for the source currency, one for the target
  • Swap operations use a pair tariff matching both currencies
  • Network fees are dynamic — updated in real-time from blockchain scanners
  • Zero-fee tariffs are valid (e.g., free internal transfers) and logged for audit

Tariff Flags

ValueFlagDescription
1DenyBlock this operation type entirely
2UseNetFeeAdd dynamic network fee (from the source network) multiplied by rate
4AgentRuleTariff applies agent commission rules (referral → agent)
8ChargeBackProtectSubtract "fresh" incoming volume from the withdrawable amount
16ManualReviewRequiredPayout / settlement requires manual review before execution
32IgnoreAddressExpenseExclude terminal network expense from the profit split for this tariff
1073741824DisabledTariff exists but is not active

Fee Preview API

Before executing a transaction, you can preview the exact fee that will be applied:

GET /trex/v1/estimate_fee
?tx_type=Outcome
&currency=USDT
&amount=1000
&network_from=2
&network_to=4
&app_id=0

For exchange / swap requests pass tx_type=ExchangeToBroker (or SwapToBroker) plus to_currency. The endpoint returns the matched tariff (tag, percentFee, fixedFee, minAmount, maxAmount) and the calculated fee when amount is supplied — using the same matcher as production.

Admin Pages

Tariffs Page

The main tariff management page displays all configured tariff rules with filtering capabilities:

  • Filter by tx_type — show tariffs for specific operation types
  • Specificity indicator — shows how many dimensions a tariff matches (more specific = higher priority)
  • "Any" badges — dimensions set to match everything are marked with gray badges
  • app_id column — shows per-project tariff assignments
  • Active/Disabled status — visual indication of tariff state

EditTariff Page

Create or modify tariff rules with organized fieldsets:

  • General — priority, tag name, transaction type
  • Groups — sender/recipient wallet groups
  • Commission — percent fee, fixed fee, network fee flag, commission accounts
  • Boundaries — minimum and maximum amount limits
  • Filters — currency, network, CRM ID, agent, app_id filters

TariffTest Simulator

Test which tariff would apply for a given scenario without executing a real transaction:

  1. Select transaction type, currencies, networks, and amount
  2. TrexWallet evaluates the configured tariff rules using the live matching behavior
  3. Shows the winning tariff, calculated fees, and the match path
  4. Useful for verifying tariff configuration before going live

Configuration Examples

Basic withdrawal fee

Priority: 10, tx_type: Outcome, percent_fee: 1%, UseNetFee: true
→ All withdrawals: 1% + blockchain network fee

VIP user discount

Priority: 50, tx_type: Outcome, from_wallet_gr: 2, percent_fee: 0.3%, UseNetFee: true
→ VIP users (group 2): 0.3% + network fee (overrides the 1% default)

Free internal transfers

Priority: 10, tx_type: InnerTransfer, percent_fee: 0, fee: 0
→ All internal transfers are free

Per-merchant acquiring fee

Priority: 80, tx_type: PaymentOrder, app_id: 42, network: 190, percent_fee: 2.5%, fee: 0.50
→ Merchant app #42 paying via Stripe (terminal id 190): 2.5% + $0.50 fixed

Payment order tariffs (post-2026-05)

Payment order tariffs are applied exactly once when order_start is called for a chosen terminal (legacy alias payment_order_start):

  • network = terminal id for per-terminal Card / P2P / Crypto rules.
  • network = 0 for a terminal-agnostic rule.
  • app_id = 0 matches every merchant app; a non-zero value is a per-app override.
  • currency payment spread is added to the rate for cross-currency orders.

Built-in pay_* methods and merchant continuation flows (flow_path) do not re-apply the tariff. The fee and rate selected by order_start remain fixed for that order.