Appearance
Royalties period close
Who: system (scheduler); staff (payouts:approve) for manual close and adjustments; creator reads statements.
Entry points
| Kind | Entry |
|---|---|
| Jobs | royalties.ensure-periods (creates monthly periods), royalties.close-due (3rd of the month, UTC), royalties.close (one period) |
| Staff | GET /staff/royalties/periods, GET /staff/royalties/periods/:id, POST /staff/royalties/periods/:id/close, POST /staff/royalties/adjustments |
| Creator | GET /profiles/:profileId/royalties/statements, GET /royalties/statements/:id, GET /royalties/statements/:id/lines |
| Deep link | studioStatement, studioEarnings |
| Push/email | royalty.statement_ready |
Flow
royalties.close-duepicks ended, unposted periods (or staffPOST …/close→ 202, job queued). Statusopen → closing.- Lock qualified streams of the month from paid subscribers only (trial plays never pay); drop streams flagged by
playback.fraud-scanand holds from safety (safety.royalties.withheld). - For each subscriber: net revenue × payout ratio (default 70%) split across only what they played; a DJ set's share by time played per track.
- Each item's amount follows its split sheet as it stood at period end (snapshot). Items without splits are held (
heldNoSplits). - Adjustments (manual, clawback, carry forward) from earlier periods apply. →
computed. - Post in one ledger transaction:
platform_revenue → royalty_pool, thenroyalty_pool → creator_earningsper statement. →posted. Eventsroyalties.period.posted,royalties.statement.ready; notificationroyalty.statement_readyto each payee owner. - A failure marks the period
failedwithfailureReason; the job retries.
Exit states
| State | Code | Actions | Client next |
|---|---|---|---|
| Posted | — | — | Creator opens the statement, then withdraws |
| Not ended yet | ROYALTY_PERIOD_NOT_ENDED | — | Wait until after month end |
| Wrong state | ROYALTY_PERIOD_INVALID_TRANSITION | — | Already closing or posted |
| Unknown | ROYALTY_PERIOD_NOT_FOUND, ROYALTY_STATEMENT_NOT_FOUND | — | — |
| Zero or carried | statement `outcome: zero | carried_forward` | — |
Notifications
royalty.statement_ready.
Known gaps
- Studio analytics has no per-profile revenue reader from royalties, so revenue widgets are empty (I14).