Single source of truth for Sellub plans, attribution sources, commission rates, fees and add-on pricing. Consumed by sellub-server, sellub-dashboard, sellub-storefront and any external integration.
Do not hardcode plan names, prices, commission rates or attribution sources anywhere else. Import from this package.
import {
SellerPlan,
SellerPlanVariant,
AttributionSource,
resolveCommissionRate,
calculateOrderFees,
PLAN_CATALOG,
ADDONS,
formatMinor,
} from "@duabalabs/sellub-pricing";
// Plan catalog (used to render pricing pages, plan cards, dashboard widgets)
PLAN_CATALOG[SellerPlan.MARKETPLACE].label; // "Sell on Sellub"
PLAN_CATALOG[SellerPlan.CUSTOM_DOMAIN].variants; // [{starter, pro}, ...]
// Commission rate for a single (plan, source) lookup
resolveCommissionRate({
plan: SellerPlan.CUSTOM_DOMAIN,
variant: SellerPlanVariant.CUSTOM_DOMAIN_PRO,
source: AttributionSource.SELLER_DIRECT_DOMAIN,
}).ratePercent; // 2
// Full fee breakdown for an order (used at checkout AND persisted)
const breakdown = calculateOrderFees({
grossAmountPesewas: 100_000,
plan: SellerPlan.CUSTOM_DOMAIN,
variant: SellerPlanVariant.CUSTOM_DOMAIN_PRO,
source: AttributionSource.MARKETPLACE_HOMEPAGE,
paymentProcessingFeePesewas: 1_950,
sellerOverridePercent: null, // admin override; null = use catalog
});| Plan | Direct commission | Marketplace-attributed | Monthly |
|---|---|---|---|
MARKETPLACE |
5% | n/a (always direct) | Free |
CUSTOM_DOMAIN |
2–3% (Pro 2%, Starter 3%) | 4.5% | GHS 250–600 |
COMMERCE_API |
1–1.5% (Growth 1%, Developer 1.5%) | 3.5% | GHS 500 / 1500 / Enterprise |
Commission depends on (sellerPlan, attributionSource) — not plan alone. Attribution sources marketplace_search, marketplace_homepage, marketplace_category, marketplace_recommendation all bill at the marketplace-attributed rate. Everything else (seller-direct, external app/API, campaigns) bills at the direct rate.
npm install
npm run build
npm test