Skip to main content
Creates commission rates — the fee definitions (flat or percentage) applied to seller orders. A unique code is auto-generated from the name when not provided. Triggered by POST /admin/commission-rates.

Usage

import { createCommissionRatesWorkflow } from "@mercurjs/core/workflows"

const { result } = await createCommissionRatesWorkflow(container).run({
  input: [
    {
      name: "Default commission",
      type: "percentage",
      value: 10,
      is_default: true,
    },
  ],
})

Input

The input is an array of commission rates to create.
name
string
required
Display name of the rate.
type
string
required
One of fixed, percentage.
value
number
required
Rate value — a percentage for percentage, an amount for fixed.
code
string
Unique code; auto-generated from the name when omitted.
currency_code
string | null
Currency of a fixed rate.
include_tax
boolean
Include tax totals in the commission base.
include_shipping
boolean
Also apply the rate to shipping methods.
is_enabled
boolean
Whether the rate is active.
is_default
boolean
Marks the rate as the platform-wide fallback.

Result

result
CommissionRateDTO[]
The created commission rates.