Commission rates
A CommissionRate defines how much commission the marketplace takes and when it applies.percentage rates use the scalar value. fixed rates read the per-currency values list and fall back to value when the order’s currency has no entry.Commission rules
Rules determine when a rate applies. Each rule has areference (the dimension) and a reference_id (the value to match):
A rate with no rules matches everything — that’s what makes the default rate a catch-all.
The matching algorithm
For each line item:- Group the rate’s rules by dimension (
reference). - A rate matches when every dimension group has at least one matching rule — AND across dimensions, OR within a dimension. Example: a rate with rules
seller: Aandproduct_category: electronicsmatches only electronics sold by seller A; a rate with twoproduct_categoryrules matches either category. - Among all matching rates, the most specific wins — the rate scoping on the largest number of distinct dimensions.
- Ties break deterministically to the oldest rate.
An electronics item from seller
slr_abc gets 8% — the two-dimension rate beats the one-dimension category rate, regardless of creation order.
The calculation pipeline
ThegetCommissionLines step calculates commissions when an order is placed:
- Load all enabled rates with their rules and per-currency values. Rates pinned to a
currency_codeapply only to orders in that currency. - Match items — for each line item, find matching rates and pick the most specific (see above).
- Calculate — the base amount is the item subtotal, plus tax when
include_taxis on. Percentage:(base × value) / 100. Fixed: the per-currency amount. - Shipping — governed solely by the global commission: when its
include_shippingflag is on, each shipping method gets a commission line calculated from the global rate. - Output — one
CommissionLineper commissioned item and shipping method.
All commission calculations use
BigNumber arithmetic for precision. This is critical for financial accuracy — standard floating-point math can introduce rounding errors.API examples
Set up the global commission (Admin API)
Create a scoped rate with rules (Admin API)
Create a fixed rate with per-currency amounts
List commission rates
Commission lines
A CommissionLine is the calculated commission for a single line item or shipping method:
Commission lines are linked to order line items via a read-only link, so an order’s items can be queried together with their commission data in a single request.
How commission connects to payouts
Commission lines are the bridge between orders and seller earnings:- An order is completed → commission lines are calculated for each item
- When the order is credited to the seller’s payout account, the total commission is subtracted:
- The marketplace retains the commission amount
CommissionLine records serve as a permanent audit trail.
Next steps
Payouts
How seller earnings settle after commission.
Order Groups
The per-seller orders commissions are calculated on.