Atomic revenue splits
Post the platform fee and the creator share in one transaction, with double-entry invariants enforced at the database.
Answers the question
How do I split revenue between platform and creator?
Summary
Revenue splits become easier to operate when the payment record and payable state are created together. Soledgic's `record_sale_atomic` posts the platform fee and creator share in a single database transaction with double-entry invariants. If the math does not balance, the transaction does not commit.
Primitives in play
- record_sale_atomic
Single RPC: debit cash, credit creator_balance + platform_revenue in one transaction.
- creator_balance accounts
Per-creator balance accounts. Real-time queryable via `get_balance`.
- product_splits / creator_tiers
Per-product or per-tier split overrides; falls back to platform default.
- risk_signals
Refund-rate, dispute, and velocity signals flow back into capability gates.
How it fits together
- Set the platform default split. When you create a ledger, set `default_platform_fee_percent`. New creators inherit this.
- Override per creator (optional). When you upsert a creator, pass `defaultSplitPercent` to override the platform default.
- Override per product (optional). Add a `product_splits` row with `creator_percent` to override for a specific SKU.
- Take payment. Create a checkout session — split metadata travels with it. On payment, `record_sale_atomic` fires.
Code
Onboard a creator with a 95/5 split
await soledgic.creators.upsert({
externalCreatorId: 'creator_maya',
email: 'maya@example.com',
defaultSplitPercent: 95, // 95% to creator, 5% platform fee
})Create a checkout — split applied on payment
const session = await soledgic.purchases.create({
creatorId: 'creator_maya',
amount: 5000, // $50.00 in cents
productName: 'Template pack',
successUrl: 'https://app.example.com/success',
})
// When the buyer pays:
// creator_balance += $47.50
// platform_revenue += $2.50
// posted atomically with double-entry guarantees.When it fits
- Creator marketplaces, course platforms, content commerce.
- Any place where the platform takes a percentage and the creator keeps the rest.
- Use cases where revenue splits need an audit-ready ledger record.
FAQ
What if the split has rounding artifacts (e.g. 33.33% × 3 ≠ 100%)?
The platform absorbs the rounding remainder. Sum of all entries always equals the gross amount; the platform_revenue entry is computed as `gross - creator_share`, not as a separate percent calculation.
Can I change the split after a sale?
Not without writing a reversal. Splits are immutable per-transaction by design. To adjust historical splits, post a corrective `transfer` between accounts via `record_transfer_atomic`.
Try it in sandbox
Sandbox keys are issued instantly. The full flow runs end-to-end against simulated rails — no real money required.