Credits
Credits
Shared across every PremiumPress product. 4 classes in inc/Credits.
Account Account.php
Members-area "Credits" panel (Ppt\Credits). Shows the buyer's current balance, the credit packs they can buy, and a short transaction statement. Wired into inc/Account/views/account.php as a #credits tab, mirroring the auction Bids and stock-photo Downloads tabs. Shared/theme-agnostic — the same panel serves any profile with the credits feature switched on.
Checkout Checkout.php
Credit-pack checkout (Ppt\Credits). A member buys a pack of credits from their members area; that routes here as /checkout/?buy_credits=_sp/_at/_ct/_ph) — it reuses the same ppt_gateway_start / ppt_gateway_verify contracts, the shared ppt_orders CPT, the /checkout/ + /callback/ virtual pages and the receipt emails. Order refs are prefixed CREDITS- so Pages::content() routes callbacks here. Shared and theme-agnostic: the Stock Photo Theme uses it now; the Software Download Theme reuses it unchanged.
Config Config.php
Credits configuration — a thin reader over the admin "Checkout ▸ Credits" panel (stored in the ppt_checkout option, section credits, edited on the Checkout admin screen next to Coupons/Tax/Shipping). Three things the admin controls: an on/off switch, the monetary value of one credit (so an asset's cash price converts to a credit cost), and the purchasable credit packs (a name, how many credits, for how much money).
Wallet Wallet.php
Prepaid credit wallet — a per-user balance plus a small transaction ledger. Shared, theme-agnostic (Ppt\Credits): the Stock Photo Theme lets buyers pay for assets with credits, and the Software Download Theme will reuse the same wallet. A generalisation of Ppt_at\BidCredits (idempotent grant/consume on an order ref) with a history trail so the members area can show statements. Balance is a plain integer counter in user meta; every change also appends a ledger entry {t,d,b,r,ref,note}. grant() and spend() are each idempotent per reference (a duplicate gateway callback or a double-submit never double-counts).