Skip to main content

Domain: payouts

Curated entry point for the payouts bounded context.

Owner

Founder + agents (Phase 1).

Mission

Owns money flowing out to traders: payout-eligibility checks, Plaid bank-account linking, payout requests, the 90/10 profit split per docs/PRD/02-business-model.md, payout processing, payout-batch operations, and tax form generation (1099 / W-8BEN). Boundary: payouts owns the cash-out side; eligibility thresholds are owned here, but eligibility based on rule compliance (e.g., consistency rule passed) is computed by risk-engine and consumed via events.

Code paths

  • Application code: apps/api/src/modules/payouts/
  • Domain logic (pure): packages/domain/payouts/
  • Contracts: packages/contracts/api/payouts.ts, packages/contracts/events/payouts.ts
  • External clients: packages/clients/plaid/
  • Database schemas owned: payouts (PayoutRequest, BankLink, PayoutTransfer, PayoutBatch, TaxForm, PlaidWebhookEvent)

PRD chapters that touch this domain

TDD chapters

(Empty - will populate as TDDs arrive.)

ADRs that affected this domain

Service interfaces this domain exposes

export interface PayoutsService {
// linkBankAccount(userId, plaidPublicToken): Promise<BankLink>
// requestPayout(accountId, amount): Promise<PayoutRequest>
// approvePayout(requestId, adminId): Promise<PayoutRequest>
// processPayoutBatch(batchId): Promise<PayoutBatch>
// generateTaxForm(userId, year): Promise<TaxForm>
// (full surface defined during payouts TDD)
}

Events this domain produces / consumes

DirectionTopicTriggered by
producespayouts.request.submittedTrader requests a payout
producespayouts.request.approvedAdmin approves (or auto-approve passes)
producespayouts.transfer.completedACH transfer settled
producespayouts.transfer.failedBank reject / NSF / reversal
producespayouts.tax_form.generatedAnnual 1099 / W-8BEN ready
consumesaccounts.account.eod_snapshot_takenRefresh payout-eligible balance
consumesrisk.evaluation.consistency_passedEligibility flag
consumesonboarding.kyc.clearedPre-payout re-KYC

External integrations

  • Plaid - bank linking, ACH-fast payouts (per docs/PRD/10-integrations.md)
  • Mercury / Brex Treasury - banking partners (per Q-I2)
  • Stripe Tax / 1099-NEC API - tax form generation

Runbooks for this domain

(Empty - will populate when alerts are defined in Section 17.6.)

On-call

To be filled in Section 17.6. Likely tight with Risk Officer and finance owner.

Cross-domain dependencies

  • This domain calls: identity, accounts, onboarding (re-KYC check).
  • This domain emits events consumed by: accounts (ledger debit), audit (every payout event - regulated), notifications (payout-status emails), admin (payout queue UI).