Payouts
Payouts
Shared across every PremiumPress product. 4 classes in inc/Payouts.
Account Account.php
Members-area "Earnings" panel (Ppt\Payouts). A contributor sees their pending balance (money owed to them), lifetime paid total, and a per-sale statement. Wired into inc/Account/views/account.php as an #earnings tab, like the Credits and Downloads tabs. Shared/theme-agnostic.
Config Config.php
Contributor-payout configuration — a thin reader over the admin "Payouts" screen (option ppt_payouts). The split is expressed as a PLATFORM COMMISSION percentage (what the site keeps on each sale), matching the mental model of the auction house commission (Ppt_at\Commission) — the contributor earns the remainder. This is a separate system from that commission, though: the auction commission is a CHARGE the house takes (buyer premium / seller invoice); payouts are the inverse — money the site OWES the contributor, accrued in Ppt\Payouts\Ledger and marked paid by the admin. Shared/theme-agnostic so a Software marketplace reuses it unchanged.
Ledger Ledger.php
Contributor earnings ledger — money the site owes each contributor for sales of the assets they uploaded, accrued per sale and marked paid by the admin. Stored as user meta on the CONTRIBUTOR (ppt_payout_entries): a list of entries {ref, listing, gross, rate, earned, currency, date, status, paid_ref, paid_date, paid_method}. accrue() is idempotent per order reference (a duplicate callback never double-credits). A pending entry becomes 'paid' when the admin records a payout (markPaidAll) — the actual money moves off-platform; this records it. Shared/theme-agnostic (Ppt\Payouts): the Stock Photo Theme accrues from _ph\Checkout::completeOrder; a Software marketplace reuses the same ledger.
Withdrawals Withdrawals.php
Member-initiated payout withdrawals (Ppt\Payouts). The Ledger records what each contributor has EARNED (per sale / per released milestone) as pending balance. This class lets the contributor actually REQUEST that balance be paid out, and gives the admin a queue to action: 1. Contributor opens the "Earnings" tab, sees their AVAILABLE balance, and submits a withdrawal request (payout method + their PayPal/bank details). 2. The request LOCKS the exact earnings it covers (snapshotted by ledger ref) so a second request can't double-spend, and later earnings stay available. 3. The admin sees pending requests on the Payouts screen and either marks one PAID (records the payout + flips those ledger entries to paid) or REJECTS it (which unlocks the balance). Money still moves off-platform (bank/PayPal/Wise) — this records the request and the settlement. Shared/theme-agnostic; gated on ThemeProfiles::supportsPayouts().