Black Branch/Docs
All sections

How money flows

This page is for owners who want to trust the numbers on their support bar. After reading it you can follow a payment from the message that announces it to the ledger, the bar and the alert, and you know what subscriptions, refunds and disputes do.

Money reaches your site from many places: card payments and PayPal on your own site, Ko-fi and Patreon, Streamlabs, and the platforms' own paid events (Twitch subs and bits, YouTube Super Chats and memberships, Kick subs and Kicks). The money itself never passes through your server. It goes to your own account with each service. Setting the services up is in Card payments (Stripe), PayPal and Venmo and Ko-fi, Patreon and Streamlabs. What viewers see is in Tips, store and subscriptions.

The paths in

flowchart LR
  ST[Stripe] -- webhook --> W[web]
  PP[PayPal] -- webhook --> W
  W -- records the payment, then sends the event --> A[stream-api]
  KF[Ko-fi, Patreon] -- webhook --> A
  SL[Streamlabs] -- socket --> A
  PL[Twitch, YouTube, Kick paid events] --> I[stream-ingest] --> A
  A --> L[(ledger)]
  A --> FX[Alert, chat card, support bar, timer]
Source Who receives it How it is proven genuine
Stripe The website, at example.com/api/billing/webhook Stripe's signature, checked with your signing secret
PayPal The website, at example.com/api/billing/paypal/webhook Checked with PayPal's own verification service
Ko-fi stream-api, at api.example.com/webhook/kofi The verification token inside each message
Patreon stream-api, at api.example.com/webhook/patreon Patreon's signature, with your webhook secret
Streamlabs stream-api connects out to Streamlabs' socket Your Streamlabs socket token
Twitch, YouTube, Kick stream-ingest reads them with the chat They arrive on the platform's own connection

The site never trusts a viewer's browser to say "I paid". A checkout that returns to your site shows a thank-you page, but nothing is granted until the payment service's own webhook arrives. That is why payments do nothing until the webhook step of each setup page is done.

A webhook can arrive twice, because services retry when they do not hear back in time. Every path remembers each event's id, and the ledger accepts each id once, so a repeat changes nothing.

The retry is also what brings a payment back after a failure, so your site answers "received" only once the payment is safely on record:

The ledger: support_events

Every payment that counts as support becomes one row in the ledger, the table stream.support_events: who paid (their person id), from which platform, what kind of event, which stream it happened during, and the take-home amount in US dollars. The support bar, the stream timer, the supporter credit, lifetime support, the income totals and Admin Panel → Payments → Payment history all read this one table.

Only stream-api writes it, and rows are never edited. A correction is a new row with its own key: a refund, for example, is a second row with a negative amount (see Refunds and disputes).

A payment made on your own site is first recorded in the website's own tables (tips, subscriptions, gifts), so the money is on record even if stream-api is restarting at that moment. The website then sends the event to stream-api, which writes the ledger row and fires the effects. That handoff is retried a few times over a few seconds. If it still fails, the website logs a line starting LOST money celebration with the event's id. The payment is safe in the website's tables, but the bar and the ledger did not get it, and someone has to send it again.

Take-home: what the ledger counts

The ledger counts what reaches you after the platform's share and the payment fees, not what the viewer paid. That way a $5 Twitch sub and a $5 Ko-fi tip move the bar by what each is really worth to you. The calculation lives in one place in stream-api, so the bar, the timer and the totals always agree.

Source How take-home is worked out
Stripe (your site) An estimate: the amount × 0.971 minus $0.30 (a typical card fee). Stripe's actual fee for that payment is not read
PayPal (your site) PayPal's own reported net amount for the payment
Twitch subs and gifted subs The tier's price (Tier 1 and Prime $4.99, Tier 2 $9.99, Tier 3 $24.99) × 50%
Twitch bits $0.01 per bit
YouTube Super Chats and Super Stickers The amount × 70%
YouTube memberships A new or gifted membership counts as $4.99 × 70% each, whatever its level. Renewals and milestones count nothing, because YouTube sends no message for a renewal
Kick subs and gifted subs $4.99 × 95% each
Kick Kicks $0.01 per Kick × 95%
Ko-fi The amount × 95%. A Ko-fi shop order or commission is a purchase, not support: it gets its alert and chat card but counts nothing
Patreon The amount × 85%. Only a new pledge is counted, not the monthly charges after it
Streamlabs The amount × 0.971 minus $0.30

These rates are built into the product. They are estimates of each platform's split and typical fees, close enough for a goal bar. Your statements from each service are the real figures.

Other currencies

The ledger is in US dollars. A payment in another currency is converted with a fixed table of approximate rates for about 50 currencies. A currency that is not in the table is not guessed: counting an unknown currency as dollars could move the bar by a hundred times the real value. Such a payment still gets its alert and chat card, but it is kept aside in stream.unpriced_support instead of the ledger, and an alarm is raised so a person can credit it by hand.

Crediting it later adds it to the ledger under the same event id, with no second alert or chat card, because the payment was already celebrated when it arrived. If the payment belongs to the stream that is live right now, the bar and the timer take the credit. A payment from an earlier stream counts only in that stream's history. There is no Admin Panel page for this yet: it is a call to stream-api with your server's internal secret.

Tips and points on your own site are charged in US dollars. Set your Stripe price and PayPal plan in US dollars too.

Why there is no single "amount" field

Every source describes a payment differently. Patreon sends cents; Twitch sends a number of bits; Kick sends a number of Kicks; Ko-fi, YouTube and Streamlabs send an amount; and subs, gifts and milestones carry no amount at all, only a tier, a number of months or a count. A check that refused any event without "an amount" would silently drop real donations and every sub. So each event is read in its own shape and priced by the table above.

Take-home is also never capped. A cap would quietly cut the most important event a stream can have, the unexpectedly large one. A negative or nonsense value is set to zero instead, and logged.

What one payment sets off

Once stream-api has the take-home amount, it fires the payment's effects:

  1. the on-stream alert (Alerts and text-to-speech) and, if spoken alerts are on, the message read aloud;
  2. a card in chat, stored like a chat message so it can be replied to, voted on and pinned;
  3. the ledger row;
  4. the support bar and the time added to the stream timer.

The ledger row comes first. Nothing on stream fires until the ledger has said "this event is new": a retried webhook is common after a restart, and celebrating before the ledger answers would show the same payment twice. If the database is slow, the alert waits for it, and a warning is logged after five seconds.

If the ledger refuses the write, stream-api tries again (after 1, 2, 5 and 10 seconds, then every 30 seconds, about two minutes in all). An error that would fail the same way every time is not retried. When it gives up, nothing fires: no alert, no bar, no timer, so nothing on stream ever shows money the ledger does not have. The payment is kept in stream.unpriced_support, marked as a failed write, an alarm is raised, and the service that sent it gets an error so it delivers the payment again later. A later delivery that does reach the ledger settles that record by itself.

Supporter subscriptions

A viewer becomes a Supporter through a monthly subscription on your site, paid by card (Stripe) or by PayPal, through a gifted subscription, or by being one of the site's staff: you, the chat bot, and any accounts listed in Admin Panel → Site → Moderators, card House accounts. Ko-fi, Patreon, Streamlabs and the platforms' own subscriptions send alerts and support-bar credit but make nobody a Supporter in this release.

You set what is sold in Admin Panel → Payments → Connections: stripe.supporterPriceId (card Stripe) names the Stripe price, and paypal.plans (card PayPal) names the PayPal plan. The setup steps are on Card payments (Stripe) and PayPal and Venmo.

One record per subscription

Each subscription is its own record, tagged with the service it came from. A viewer can hold more than one. The rule is the same for every service:

A service counts only while its module is on. Switching Card payments or PayPal and Venmo off (the first switch on its card in Admin Panel → Payments → Connections) ends its subscribers' perks at once, while the service may keep charging them, so cancel their subscriptions with the service first. Switching it back on restores the perks, because the records are kept.

Buying while a gift runs

A viewer who buys a card subscription while a gifted one is running pays nothing twice. The Stripe subscription starts with a trial that lasts until the gift ends, and billing starts then. A trial is not a payment: it adds nothing to the ledger, and if the first charge after it fails, the subscription grants nothing.

Only the payment service changes a subscription

One piece of code is the only writer of a subscription's tier and status, and it runs only where the payment service itself has vouched for the change:

When it runs Why it can be trusted
A Stripe or PayPal webhook arrives, after its signature is checked The service says so, and the message is proven to come from it
Every 6 hours, the site reads from PayPal each PayPal subscription that is about to run out or has not been read for a week The service is asked directly

Nothing a viewer's browser says grants access: not the return from a checkout, not PayPal's "approved" pop-up, not the site's own Cancel button. Subscribing and cancelling ask the service, and the record changes when the service's answer arrives. With one writer, two events arriving out of order or at once cannot leave a subscription in a state the service does not have.

Access until a date

Every record carries the date its access runs out: the end of the period paid for, plus 7 grace days. A renewal moves the date on. The site checks the date each time it asks "is this viewer a Supporter?", so when a cancel or end message is lost for good (a webhook down, a module switched off past the service's retries), access still stops on its own.

Service Access runs until
Stripe The end of the current period, plus 7 days. Stripe's own status decides first: a cancelled or ended subscription stops counting when Stripe says so. A subscription set to cancel at a later date shows as "renewal off" and keeps access until then. While Stripe retries a failing card, access continues. When Stripe's final retry fails, the subscription ends here too and access stops at that moment; paying the invoice later makes it active again
PayPal The next billing date, plus 7 days. If a payment fails, a month after the last completed payment, plus 7 days. A subscriber who cancels keeps access to the end of the month they paid for

Money from subscriptions

A Stripe subscription's first payment is credited when Stripe announces the subscription, and each renewal when Stripe announces the paid invoice for the next period. A PayPal subscription's first payment and each renewal are credited when PayPal announces the completed payment. Each becomes one ledger row and one chat card, like a tip.

Refunds and disputes

When Stripe or PayPal reports a refund or a dispute:

A refund or dispute can arrive before the payment it undoes, because services do not deliver events in order. Both the points and the ledger keep such a reversal waiting, and take it back in the same step as the payment when the payment arrives. A refund that later fails, or a dispute you win, gives the points back.

Refunds and disputes never end a subscription by themselves; the subscription's own status at the service does. A gift is the exception: a refund or dispute on a gift ends that gift at once, and its recipient stops being a Supporter through it (community gifts not yet handed out are withdrawn too).

What a reversal takes back

What a reversal changes, and what it leaves

Goes down Stays as it was
The viewer's lifetime support and the support tiers read from it The support bar for the stream the payment came in
The weight of the viewer's name in the supporter credit The stream timer, and a funded night's time
The 30-day received total in Payment history, where the reversal shows as its own line with a negative amount The Stream tab's earnings for the stream the payment came in

A reversal belongs to no stream, which is why the bar and the timer never move: time already played on stream cannot be taken back, and a bar that jumped down mid-stream would only confuse viewers. On the Stream tab, a reversal counts as negative off-stream money for the stream whose window it lands in (the time since the stream before it ended), not against the stream the payment came in.

What is not reversed

Ko-fi, Patreon, Streamlabs and the platforms' own paid events (Twitch subs and bits, YouTube Super Chats, Kick subs) are never reversed: none of them tells your site about a refund. Your statements from each service are the real figures.

Points are a separate ledger

Points have their own ledger, written only by the website. Every point earned, bought, spent, refunded or taken back is one row there.

Points and money are kept apart on purpose:

A tip from a signed-in viewer does both things at once, separately: the tip is support (one ledger row, at take-home), and the points that come with it are a wallet credit (one points row).

Where this is going

Designs, not in this release. This section describes where the Supporter rule is heading.

The same Supporter rule is meant to take in more services, with you choosing which ones count:

  1. Patreon memberships. The viewer signs in with Patreon once from their account page (OAuth), so the site learns which Patreon member they are. From then on the site reads memberships with your own creator access.
  2. Ko-fi memberships. Ko-fi has no sign-in to borrow, so the viewer either puts a one-time code from their account page in the message of their first membership payment, or types their Ko-fi email and you approve the claim after checking your Ko-fi dashboard. A typed email never counts by itself, because anyone could type anyone's email. Ko-fi never says when a membership ends, so access would run to a month after the last payment, plus the grace days.
  3. Maybe, later: Twitch and Kick channel subscriptions, counted through the platform accounts viewers have already linked. This one is not decided.

Until a Patreon or Ko-fi payment is linked to a viewer it would make nobody a Supporter. The alerts and support-bar credit for Ko-fi and Patreon keep coming exactly as they do today, and the link itself never fires an alert or adds to the bar, so nothing is counted twice.

Two services stay out:

Next: Inside the AI features

← How it works