Introduction to Zooly payment and revenue distribution system
Zooly is an intellectual property marketplace where content creators (buyers) pay celebrities/talent (sellers) for the right to use their likeness in AI-generated content. The payment system handles the full lifecycle: collecting payments from buyers, distributing revenue among multiple stakeholders, accumulating shares until payout thresholds are met, and transferring funds to talent via Stripe Connect.
All monetary amounts are in integer cents, not dollars. Every variable, parameter, column, and API field that represents money must use the Cent suffix to make the unit unambiguous (e.g. amountCent, platformFeeCent, totalBrandPriceCent). Never store or pass currency as floating-point dollars in the payment system.
payFor: "OFFER", escrow until delivery is accepted)The payment system is designed to be Product Agnostic. This means that the payment system doesn't know about specific products. Instead, the product details are stored in domain-specific tables.
The payment system is linked to the product via the payFor enum and the payForId foreign key.
The product details are stored in domain-specific tables.
payFor enum + payForId foreign keySee Adding a New Product for more details.
Currently, only a server-side payment flow has been implemented. A client-side payment flow is planned to support the Product-Agnostic Design using a dedicated Stripe context provider.
A payment consists of two linked records: a product record (product-specific) and a stripePayment record (generic Stripe payment details and status).
Creation Flow:
SUCCEEDEDBidirectional Relationship:
payForId/payFor fieldsstripePaymentId fieldAmount Handling:
getProductByPayForId() when neededQuerying Payments:
Total Payment Amount (e.g., $100.00 = 10000 cents)
|
|-- Stripe Fee = $0.30 + 2.9% = $3.20 (320 cents)
|-- Zooly Platform Fee = fixed AI creation cost (e.g., $5.00)
|-- Talent Share = $100.00 - $3.20 - $5.00 = $91.80
|
|-- If talent has Agent: Agent gets X% of Talent share
| e.g., 15% of $91.80 = $13.77 → Talent gets $78.03
|
|-- If has Host Partner: Partner gets 10% of Platform share
| e.g., 10% of $5.00 = $0.50 → Platform gets $4.50
|
|-- If has Ambassadors:
| Each ambassador gets SAME 10% of Platform share (AMBASSADOR_SHARE = 0.1)
| Total deducted from platform = 10% * number_of_ambassadors