Skip to main content
The Commission module doesn’t define or emit domain events. Commission lines are derived from the order, so the module listens to order events instead and recomputes the lines when the order’s contents change.

Events that trigger a recompute

The order-commission-refresh-handler subscriber, in packages/core/src/subscribers/order-edit-confirmed.ts, runs refreshOrderCommissionLinesWorkflow for the order on each of these events. The subscriber reads order_id and falls back to id. It does nothing when the payload has neither. The events come from Medusa as OrderEditWorkflowEvents.CONFIRMED, OrderWorkflowEvents.RETURN_RECEIVED, OrderWorkflowEvents.CLAIM_CREATED, and OrderWorkflowEvents.EXCHANGE_CREATED. Checkout doesn’t go through an event. completeCartWithSplitOrdersWorkflow runs the refresh as a nested step for every seller order it creates.

Run your own logic after a recompute

Subscribe to the same order events to run your own logic when an order’s commission may change.
src/subscribers/commission-audit.ts
Subscribers run independently, so this one can run before the refresh finishes. When you need the new lines, use the commissionLinesUpserted hook of refreshOrderCommissionLinesWorkflow, which runs after they’re written. See Refresh order commission lines.
Like every MedusaService module, the Commission service also emits Medusa’s internal data-mutation events when records are created, updated, or deleted. Mercur doesn’t subscribe to them, and this reference doesn’t treat them as a stable contract.