Skip to main content
Use Mercur to keep financial control over what share of each sale the marketplace keeps and each seller earns. Financial control over the marketplace runs through commission. You set policy-based rates (fixed or percentage) and scope them to parts of your catalog with rules. Mercur resolves the right rate for every order line by most-specific-wins and writes an auditable commission line. That line is the exact amount deducted before the seller is paid out, computed in arbitrary precision so the numbers reconcile.
Commission = the CommissionRate + CommissionRule entities. A rate is the number, either a percentage or a fixed amount. Rules scope that rate to a slice of the catalog. Every marketplace has one Global Commission. This is the is_default rate that applies when nothing more specific matches.

Key features

  • Fixed or percentage: a percentage of the line, or a flat per-currency amount.
  • Per-currency amounts: fixed rates carry an amount per currency, falling back to a default value.
  • Five scoping dimensions: match on product, product_type, product_collection, product_category, and seller.
  • Most-specific-wins: the rate scoped on the most dimensions wins, and ties break to the oldest rate.
  • Shipping commission: only the global rate may commission shipping (include_shipping).
  • Automatic order lines: a commission line is generated per item and recomputed when an order changes.
  • BigNumber arithmetic: all commission math uses arbitrary precision for financial accuracy.

Get started

Learn how the domain fits together.

Rules & rates

Fixed vs. percentage rates, per-currency amounts, and the global rate.

Rule matching

The five dimensions, most-specific-wins, tie-breaks, and shipping.

Order commission lines

How per-order lines are computed and kept in sync.

Examples

Build against the Commission domain in your own code.

Create a rate

Run createCommissionRatesWorkflow from a route or seed script.

Batch-update rules

Create, update, and delete a rate’s rules in one call.

Refresh order lines

Recompute commission for an order after it changes.

Resources

Data models, workflows, service methods, and events for the Commission domain.

Data models

CommissionRate, CommissionRule, and related entities.

Links

How Commission connects to catalog, sellers, and orders.

Workflows

Rate, rule, and order-line workflows.

Service

Module service methods for working with records directly.

Events

How commission stays in sync with order changes.