Rewrites the payments plan for a separate payments service, with Patreon as the first way to pay.
**docs/payments.md**
- **`t5de-payments` is its own service:** its own repo, Postgres database and secrets, at `payments.t5de.dev`, to contain the compliance risk. The hub and Music never hold a payment provider's key. Music reads entitlements (`GET /v1/entitlements/{sub}`), is told about changes over a signed back-channel call, and keeps the last answer it got.
- **Patreon first:** Patreon is the seller, so it handles sales tax and VAT.
- **Linking:** members link Patreon with OAuth (`identity`).
- **Tiers:** which tier gives how much is set in config in git.
- **Webhook:** the service checks its webhook exists and is set up right on every start, and fixes it if not. Requests are verified with `X-Patreon-Signature` (HMAC-MD5).
- **State:** after a webhook it re-fetches the member from Patreon, and a nightly sync of every member catches anything missed.
- **Grace:** access runs until `next_charge_date` plus 7 days.
- **Tokens:** Patreon rotates the creator token's refresh token, so the current pair is kept in the database.
- **Entitlements are counts** (`music.rooms` × N), because a Patreon member has only one tier. Moderators' grants (no money) come first, in phase 1.
- **Processors:**
- **Polar:** used only if their support says yes in writing. Its acceptable use policy names YouTube downloaders (#30) and circumventing other services' terms (#18).
- **Not used:** Stripe or PayPal directly (we'd be the seller), and IMVU credits.
**docs/music.md**
- **The paid tier sells hosting only.** YouTube limits are now the same in both tiers.
- **Tiers:** Room ($1.99, 1 room) and Rooms ($4.99, 3 rooms). The owner picks which rooms are paid. When the count drops, the most recently picked rooms go back to free first.
- The risks section and phase 3b point to t5de-payments.
Rewrites the payments plan for a separate payments service, with Patreon as the first way to pay.
**docs/payments.md**
- **`t5de-payments` is its own service:** its own repo, Postgres database and secrets, at `payments.t5de.dev`, to contain the compliance risk. The hub and Music never hold a payment provider's key. Music reads entitlements (`GET /v1/entitlements/{sub}`), is told about changes over a signed back-channel call, and keeps the last answer it got.
- **Patreon first:** Patreon is the seller, so it handles sales tax and VAT.
- **Linking:** members link Patreon with OAuth (`identity`).
- **Tiers:** which tier gives how much is set in config in git.
- **Webhook:** the service checks its webhook exists and is set up right on every start, and fixes it if not. Requests are verified with `X-Patreon-Signature` (HMAC-MD5).
- **State:** after a webhook it re-fetches the member from Patreon, and a nightly sync of every member catches anything missed.
- **Grace:** access runs until `next_charge_date` plus 7 days.
- **Tokens:** Patreon rotates the creator token's refresh token, so the current pair is kept in the database.
- **Entitlements are counts** (`music.rooms` × N), because a Patreon member has only one tier. Moderators' grants (no money) come first, in phase 1.
- **Processors:**
- **Polar:** used only if their support says yes in writing. Its acceptable use policy names YouTube downloaders (#30) and circumventing other services' terms (#18).
- **Not used:** Stripe or PayPal directly (we'd be the seller), and IMVU credits.
**docs/music.md**
- **The paid tier sells hosting only.** YouTube limits are now the same in both tiers.
- **Tiers:** Room ($1.99, 1 room) and Rooms ($4.99, 3 rooms). The owner picks which rooms are paid. When the count drops, the most recently picked rooms go back to free first.
- The risks section and phase 3b point to t5de-payments.
Co-authored-by: dhkatz <[email protected]>
10 KiB
Payments (plan)
Status: draft (2026-11-20). Decisions marked Decided were agreed in discussion; the rest are proposals. Open decisions are at the end.
Paid offerings for Music now (docs/music.md, Paid tier) and maybe for the hub later. Payments are their own service,
t5de-payments, and the first way to pay is a Patreon membership.
Goals
- Contain the risk (Decided): processor accounts, their keys, payment records and webhooks live in one small service with its own database and secrets, apart from the hub and Music. A processor closing an account, or a payments bug, touches only this service; the hub and Music never hold a processor's key.
- No tax work of our own (Decided): only platforms that are the seller (or collect and remit tax for us), so sales tax and VAT are theirs. No Stripe or PayPal directly, where we'd be the seller.
- No IMVU credits (Decided).
- No card data anywhere of ours: the platform's own pages for joining, paying and cancelling.
- Apps ask one question: how much of entitlement X does this account have? They never talk to a processor.
Where it lives (Decided)
t5de-payments: its own repository, image, stack and Postgres database, at payments.t5de.dev. Deployed like the
other stacks, with its secrets in sops like theirs.
- Who's who: it's an OIDC client of the hub (docs/music.md, The OIDC provider), like Music, and knows people by
their
sub. It never sees their IMVU accounts or rooms. - Apps read entitlements with their own client credentials,
GET /v1/entitlements/{sub}, and are told about changes over a signed back-channel call (entitlements.changed {sub}, asuser.merged), after which they read again. Music keeps the last answer, so payments being down doesn't change any room. - Its pages (sign-in, link Patreon, what you have) are few and plain; Music links to them from Account.
music.t5de.dev ─── link Patreon ───► payments.t5de.dev ◄── webhooks, members ──► Patreon
▲ │
└──── entitlements.changed, GET ─────┘
Concepts
| What | |
|---|---|
| Provider | Where money comes from: patreon now, maybe polar (Processors, below), grant for moderators' gifts and testers. |
| Link | A person's account at a provider: (sub, provider) → provider's user ID, unique both ways. |
| Source | One thing that grants: a Patreon membership, a grant. Mirrored from the provider: status, tier, paid until. |
| Event | Every webhook as received, with its verdict. Kept for the audit log; never trusted for state (below). |
| Entitlement | What apps read: {sub, key, quantity, until, source}, e.g. music.rooms × 3 until a date. An account's total is the sum of its live entitlements per key. |
Entitlements are counts, not tied to a room: a Patreon member has one tier, so tiers are room bundles. Music decides which of the owner's rooms are paid (docs/music.md, Paid tier).
Every change recomputes: a webhook, a nightly sync or a grant fetches the source's current state from the provider and recomputes that account's entitlements from all its sources. Late, repeated, missed or reordered events then all end in the same place.
Patreon (Decided: first)
Patreon is the seller: it collects and remits VAT and US sales tax where required, runs payments, retries, refunds and cancelling, and pays out. The page is T5DE Music's alone and marked not for adults; the hub's adult offerings never go on it. Fees: 10% of income plus payment processing (patreon.com/pricing).
Set up by hand on patreon.com (the API reads tiers, it can't write them): the page, the tiers, payouts and tax
details, and an API client in the developer portal (its redirect URI is
https://payments.t5de.dev/patreon/callback).
Configuration, in git: the campaign's ID and each tier's ID with what it grants:
patreon:
campaign: "<campaign ID>"
tiers:
"<Room tier ID>": { music.rooms: 1 }
"<Rooms tier ID>": { music.rooms: 3 }
A tier that isn't listed grants nothing (a free membership, a tier for something else).
Linking: signed in, the person presses "Link Patreon" and approves our client on Patreon (scope identity). We
keep their Patreon user ID; include=memberships on /identity shows their membership to our campaign. A membership
whose Patreon account isn't linked yet grants nothing until it is, then counts at once. One Patreon account links to
one T5DE account; linking it elsewhere asks to unlink first.
The creator token (the developer portal's, scopes campaigns, campaigns.members, w:campaigns.webhook) reads
members and manages the webhook. It's seeded from sops; Patreon's refresh hands out a new refresh token each time, so
the current pair lives in the database, and an expiring or refused token is an alert.
The webhook is ours to keep right: on start the service lists its webhooks (/api/oauth2/v2/webhooks shows only
our client's), creates one if there's none, and patches its URI, triggers and paused: false if they've drifted.
The secret Patreon returns is kept in the database.
- Triggers:
members:create,members:update,members:delete,members:pledge:create,members:pledge:update,members:pledge:delete. - Each request is checked against
X-Patreon-Signature(the hex HMAC-MD5 of the body with the webhook's secret) before anything else; then the member is fetched again (/api/oauth2/v2/members/{id}, withcurrently_entitled_tiers) and that account recomputed. - Patreon retries for a week and then pauses the webhook. The start-up check unpauses it, and a nightly sync of
every member (
/campaigns/{id}/members) catches anything missed.
From a member to an entitlement:
| Patreon says | Entitlement |
|---|---|
patron_status: active_patron, a listed tier in currently_entitled_tiers |
The tier's grant, until next_charge_date plus 7 days' grace |
declined_patron (a failed charge; Patreon retries) |
Kept until the grace runs out |
former_patron, deleted, or no listed tier |
None |
Yearly memberships (pledge_cadence: 12) need nothing more: their next_charge_date is a year off. Patreon turns
them on for a page after some membership history; we've asked to be included.
Refunds, chargebacks and cancelling are Patreon's; the member's status follows them and our entitlement with it.
Grants
Moderators give entitlements without money (testers, gifts, apologies): {sub, key, quantity, until, reason, by},
from an admin command first and a page later, every one in the audit log. Phase 1 is built on these, so the paid
tier is tested before anyone pays.
Processors
| Notes | ||
|---|---|---|
| Patreon | Used | Above. No upfront review of what's offered; its guidelines still forbid infringing content, so the pages sell hosting (docs/music.md, Paid tier). |
| Polar (merchant of record) | To ask, not used | 5% + 50¢ (+1.5% for non-US cards) on new accounts. Its acceptable use policy (2026-10-01) forbids "third-party content downloaders, including … YouTube" (#30) and "services to circumvent the rules, paywalls or terms of other services" (#18). To ask its support, with an honest description; built only on a written yes. |
| Paddle, Stripe Managed Payments | Not used | Merchants of record with the same rules against downloaders and infringement. |
| Stripe, PayPal directly | Not used | We'd be the seller: sales tax and VAT ours. |
| Adult-friendly processors (CCBill, Segpay, Verotel, Epoch) | For the hub, later | Only if the hub ever sells adult content; a separate merchant account, never through Music's. Whether it's this service or another is decided then. |
A provider is an adapter behind one interface, so Polar (or another) can run beside Patreon:
interface Provider {
// Where to send a signed-in person to start paying, and to manage what they pay for.
join(sub, offer): Promise<{ url: string }>;
manage(sub): Promise<{ url: string }>;
// Verifies the signature; null when the request isn't the provider's.
webhook(request): Promise<{ source: string } | null>;
// A source's current state, fetched from the provider.
source(id): Promise<SourceState>;
// Every source, for the nightly sync.
sources(): AsyncIterable<SourceState>;
}
Lapses
- A failed renewal keeps the entitlement for 7 days past the charge date (Patreon retries meanwhile), then the extra rooms drop to the free tier. Nothing is deleted; paying again brings them back.
- Every grant, change and revocation is in the audit log, with the event or person that caused it.
Selling as an individual
- No company is needed: Patreon (and the merchants of record) accept individuals with a tax ID (SSN in the US) and a bank account. Patreon reports the income (a 1099-K in the US); it goes on a personal return (Schedule C), with self-employment tax on the profit.
- Patreon is the seller, so tax on the sales is Patreon's, not ours; income tax on the payouts is ours.
- A single-member LLC later: state filing fees vary widely, plus a free EIN and a registered agent to keep a home address off public records. It shields personal assets from the business's debts and contracts, but not from claims about what its owner did personally, such as infringement.
- An hour with an accountant before the first sale; this section isn't tax or legal advice.
Phases
- Entitlements without money: the service with sign-in, grants, entitlements and the back-channel; Music's paid
features behind
music.rooms. Lets the paid tier be tested and given away before anyone pays. - Patreon: linking, the webhook, the nightly sync; the page published.
- Polar, if it says yes.
- The hub's offerings, if it ever sells any (Processors, above).
Before taking money
- Terms of service: what's paid for (hosting, never a source), that sources such as YouTube can stop working or be switched off without refunds, and Patreon's refunds.
- A privacy policy covering what's kept from Patreon (user ID, membership status and tier, no payment details).
- The accountant's hour (Selling as an individual, above).
Open decisions
- Polar's answer.
- Whether grants get a page, or stay an admin command.
- The tiers after launch: a 10-room tier for clubs, prices once there's usage to look at.