Concepts, value, and typical clone scenarios — less code.
Concepts, value, and typical clone scenarios — less code.
Підготовка контенту платформи Ring
Підготовка контенту платформи Ring
Підготовка контенту платформи Ring
settlement.ts calculates platform commission, optional referral commission, and merchant splits. This is the vendor-funded rail. Platform-funded token rewards live on refcodes.
Same orderReference should appear on settlements, erp_sales_assists, and referral_rewards for cross-audit. See Affiliate enablement.
/admin/store/commissions| Action | What it does |
|---|---|
| Status filters | Pending / held / completed |
| Dry-run due payouts | Counts due rows + net total — no money moved |
| Process due payouts | Runs processDueSettlements for scheduledFor <= now and status = pending |
| Hold | Blocks a pending settlement from payout (status = held) |
| Release | Returns a held settlement to pending |
| Referral rates table | Effective % per product with resolver source |
Vendor view: /vendor/earnings — pending + history from the same settlements collection. Simulated payouts show a Simulated badge until on-chain mode is production-verified.
Depends-on: stock commit before settlement side-effects on paid order.
Same-workflow: dual-rail overview and verification checklist.
See-also: platform-funded token rewards sharing commission resolver.
Next-step: vendor earnings and merchant config context.
settlement.ts calculates platform commission, optional referral commission, and merchant splits. This is the vendor-funded rail. Platform-funded token rewards live on refcodes.
Same orderReference should appear on settlements, erp_sales_assists, and referral_rewards for cross-audit. See Affiliate enablement.
/admin/store/commissions| Action | What it does |
|---|---|
| Status filters | Pending / held / completed |
| Dry-run due payouts | Counts due rows + net total — no money moved |
| Process due payouts | Runs processDueSettlements for scheduledFor <= now and status = pending |
| Hold | Blocks a pending settlement from payout (status = held) |
| Release | Returns a held settlement to pending |
| Referral rates table | Effective % per product with resolver source |
Vendor view: /vendor/earnings — pending + history from the same settlements collection. Simulated payouts show a Simulated badge until on-chain mode is production-verified.
Depends-on: stock commit before settlement side-effects on paid order.
Same-workflow: dual-rail overview and verification checklist.
See-also: platform-funded token rewards sharing commission resolver.
Next-step: vendor earnings and merchant config context.
settlement.ts calculates platform commission, optional referral commission, and merchant splits. This is the vendor-funded rail. Platform-funded token rewards live on refcodes.
Same orderReference should appear on settlements, erp_sales_assists, and referral_rewards for cross-audit. See Affiliate enablement.
/admin/store/commissions| Action | What it does |
|---|---|
| Status filters | Pending / held / completed |
| Dry-run due payouts | Counts due rows + net total — no money moved |
| Process due payouts | Runs processDueSettlements for scheduledFor <= now and status = pending |
| Hold | Blocks a pending settlement from payout (status = held) |
| Release | Returns a held settlement to pending |
| Referral rates table | Effective % per product with resolver source |
Vendor view: /vendor/earnings — pending + history from the same settlements collection. Simulated payouts show a Simulated badge until on-chain mode is production-verified.
Depends-on: stock commit before settlement side-effects on paid order.
Same-workflow: dual-rail overview and verification checklist.
See-also: platform-funded token rewards sharing commission resolver.
Next-step: vendor earnings and merchant config context.
| Action | Path |
|---|---|
processDueSettlementsAction | app/_actions/admin-store-erp.ts |
previewDueSettlementsAction | dry-run preview |
holdSettlementAction / releaseHeldSettlementAction | wraps holdSettlement / releaseHeldSettlement |
| Cron | ProcessConductor settlement-payout → /api/cron/settlement-payout |
Shared resolver features/store/lib/referral-commission.ts:
| Priority | Source |
|---|---|
| 1 | Product referralCommission |
| 2 | Merchant commissionStructure.referralCommission |
| 3 | Platform default (5%) |
| 4 | Env REFERRAL_REWARD_PERCENT |
Optional clamp: REFERRAL_COMMISSION_MAX_PERCENT (default 50).
SETTLEMENT_PAYOUT_MODE | Behavior |
|---|---|
simulated (default) | Completes with metadata.simulated / sim_ id |
onchain | ERC20 via treasury (SETTLEMENT_PAYOUT_PRIVATE_KEY, token address, RPC) |
Migration 007_settlements_schema.sql (plus inventory tables in schema / 008_*). Dev helper: ./scripts/apply-erp-migrations-dev.sh when present on the clone.
Prerequisite: paid handlers trigger processSettlements.
| Action | Path |
|---|---|
processDueSettlementsAction | app/_actions/admin-store-erp.ts |
previewDueSettlementsAction | dry-run preview |
holdSettlementAction / releaseHeldSettlementAction | wraps holdSettlement / releaseHeldSettlement |
| Cron | ProcessConductor settlement-payout → /api/cron/settlement-payout |
Shared resolver features/store/lib/referral-commission.ts:
| Priority | Source |
|---|---|
| 1 | Product referralCommission |
| 2 | Merchant commissionStructure.referralCommission |
| 3 | Platform default (5%) |
| 4 | Env REFERRAL_REWARD_PERCENT |
Optional clamp: REFERRAL_COMMISSION_MAX_PERCENT (default 50).
SETTLEMENT_PAYOUT_MODE | Behavior |
|---|---|
simulated (default) | Completes with metadata.simulated / sim_ id |
onchain | ERC20 via treasury (SETTLEMENT_PAYOUT_PRIVATE_KEY, token address, RPC) |
Migration 007_settlements_schema.sql (plus inventory tables in schema / 008_*). Dev helper: ./scripts/apply-erp-migrations-dev.sh when present on the clone.
Prerequisite: paid handlers trigger processSettlements.
| Action | Path |
|---|---|
processDueSettlementsAction | app/_actions/admin-store-erp.ts |
previewDueSettlementsAction | dry-run preview |
holdSettlementAction / releaseHeldSettlementAction | wraps holdSettlement / releaseHeldSettlement |
| Cron | ProcessConductor settlement-payout → /api/cron/settlement-payout |
Shared resolver features/store/lib/referral-commission.ts:
| Priority | Source |
|---|---|
| 1 | Product referralCommission |
| 2 | Merchant commissionStructure.referralCommission |
| 3 | Platform default (5%) |
| 4 | Env REFERRAL_REWARD_PERCENT |
Optional clamp: REFERRAL_COMMISSION_MAX_PERCENT (default 50).
SETTLEMENT_PAYOUT_MODE | Behavior |
|---|---|
simulated (default) | Completes with metadata.simulated / sim_ id |
onchain | ERC20 via treasury (SETTLEMENT_PAYOUT_PRIVATE_KEY, token address, RPC) |
Migration 007_settlements_schema.sql (plus inventory tables in schema / 008_*). Dev helper: ./scripts/apply-erp-migrations-dev.sh when present on the clone.
Prerequisite: paid handlers trigger processSettlements.