a6337f09b61aca63697c15065844feeeca6d02b1
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a6337f09b6 |
docs(payments): PayPal beside Patreon, our own checkout later (#28)
Updates the payments plan with PayPal and the decisions since #26. **docs/payments.md** - **PayPal (new section):** sold exactly as priced, $1.99 a month or $19.99 a year per room, as one subscription with a room count. - **Setup:** the product, plans and webhook are made through PayPal's API, and their IDs go in the config. The sandbox ones exist already. - **Checkout:** a redirect. The subscription carries the account (`custom_id` = the person's `sub`) and the VAT override. - **Webhook:** verified by PayPal's own `verify-webhook-signature`; the subscription is then fetched again from PayPal, plus a nightly sync. A status table says what each PayPal state grants. - **Tax:** - **EU VAT:** non-Union OSS, with VAT included in the price. Each sale records two pieces of country evidence (the buyer's choice and their IP's country); if they disagree, no sale. The service makes the quarterly report itself. - **UK:** handled once registered with HMRC. - **US:** state thresholds, with sales reported per state. - **Where it sells first:** outside the EU and the UK until those registrations take effect. - **No website of its own:** the app's pages use the API. The browser only passes through `/link/patreon`, `/checkout/paypal` and `/manage/<source>`, which return only to listed addresses. - **Checkout elements (later):** our own checkout as iframes from `payments.t5de.dev`, so the processor doesn't show and Patreon can go. - **Environments:** staging uses PayPal's sandbox and the locked staging hub. Patreon has no test mode, so both of its redirect URIs are listed. - Goals, the processors table, lapses, phases (Patreon, then PayPal, then elements) and "before taking money" updated to match. **docs/music.md:** the paid tier lists both ways to pay, plus the later checkout. Updates the payments plan with PayPal and the decisions since #26. **docs/payments.md** - **PayPal (new section):** sold exactly as priced, $1.99 a month or $19.99 a year per room, as one subscription with a room count. - **Setup:** the product, plans and webhook are made through PayPal's API, and their IDs go in the config. The sandbox ones exist already. - **Checkout:** a redirect. The subscription carries the account (`custom_id` = the person's `sub`) and the VAT override. - **Webhook:** verified by PayPal's own `verify-webhook-signature`; the subscription is then fetched again from PayPal, plus a nightly sync. A status table says what each PayPal state grants. - **Tax:** - **EU VAT:** non-Union OSS, with VAT included in the price. Each sale records two pieces of country evidence (the buyer's choice and their IP's country); if they disagree, no sale. The service makes the quarterly report itself. - **UK:** handled once registered with HMRC. - **US:** state thresholds, with sales reported per state. - **Where it sells first:** outside the EU and the UK until those registrations take effect. - **No website of its own:** the app's pages use the API. The browser only passes through `/link/patreon`, `/checkout/paypal` and `/manage/<source>`, which return only to listed addresses. - **Checkout elements (later):** our own checkout as iframes from `payments.t5de.dev`, so the processor doesn't show and Patreon can go. - **Environments:** staging uses PayPal's sandbox and the locked staging hub. Patreon has no test mode, so both of its redirect URIs are listed. - Goals, the processors table, lapses, phases (Patreon, then PayPal, then elements) and "before taking money" updated to match. **docs/music.md:** the paid tier lists both ways to pay, plus the later checkout. Co-authored-by: dhkatz <[email protected]> |
||
|
|
f3cc3f9f17 |
feat(accounts): locked registration, for staging (#27)
Locks staging down before payments' staging (PayPal's sandbox) exists. **The problem:** staging's registration is closed, but signing in with Discord still makes an approved basic account at once (`auth.ts`). So any Discord account can sign in to Music's staging. **The change:** a third registration setting, `locked`: - Every new account waits for a moderator's approval, Discord sign-ins too. - Only approved accounts sign in to T5DE's other sites. The gate is the OAuth provider's `postLogin.shouldRedirect`: an unapproved account is sent to the website (which shows "Waiting for Approval") and no code is issued. It runs on every authorize request and on `/oauth2/continue`. - Finishing setup under `locked` keeps the person's approval, so an approved basic account doesn't lose Music access by becoming a member. - **Console:** the setting has a "Locked" option. **Website:** the waiting screen for unapproved Discord accounts, and the sign-up page's note. `open` and `closed` behave as before. Under `closed`, a member waiting for approval still signs in to Music (tested), so prod doesn't change. **After merging:** infra sets staging's `REGISTRATION` to `locked`. That's only a default: if staging's registration was ever changed in the console, set it to Locked there. Accounts already on staging keep their approval. **Checks:** `bun test` (77 pass, two new tests), `check-types`, `lint`. Locks staging down before payments' staging (PayPal's sandbox) exists. **The problem:** staging's registration is closed, but signing in with Discord still makes an approved basic account at once (`auth.ts`). So any Discord account can sign in to Music's staging. **The change:** a third registration setting, `locked`: - Every new account waits for a moderator's approval, Discord sign-ins too. - Only approved accounts sign in to T5DE's other sites. The gate is the OAuth provider's `postLogin.shouldRedirect`: an unapproved account is sent to the website (which shows "Waiting for Approval") and no code is issued. It runs on every authorize request and on `/oauth2/continue`. - Finishing setup under `locked` keeps the person's approval, so an approved basic account doesn't lose Music access by becoming a member. - **Console:** the setting has a "Locked" option. **Website:** the waiting screen for unapproved Discord accounts, and the sign-up page's note. `open` and `closed` behave as before. Under `closed`, a member waiting for approval still signs in to Music (tested), so prod doesn't change. **After merging:** infra sets staging's `REGISTRATION` to `locked`. That's only a default: if staging's registration was ever changed in the console, set it to Locked there. Accounts already on staging keep their approval. **Checks:** `bun test` (77 pass, two new tests), `check-types`, `lint`. Co-authored-by: dhkatz <[email protected]> |
||
|
|
02e8269d4d |
docs(payments): a payments service of its own, Patreon first (#26)
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]>
|
||
|
|
a66a3a4b6a |
docs: Music and shared accounts plan (#21)
Plan for T5DE Music and the account and payment changes it needs. Docs only; no code changes. - `docs/music.md`: an IMVU room music bot. The website is music.t5de.dev (at home); streams are radio.t5de.dev (Oracle Cloud's free tier, dhkatz/infra `music-oracle`). Covers one account system with Discord sign-in and basic accounts, the hub as an OIDC provider with Music as its first client, room ownership from linked IMVU accounts, chat commands and permissions, pluggable sources modelled on HorizonRadio's (stations, own streams, YouTube), relayed vs direct streams, and the paid tier (sell the hosting; $1.99 a month per room). - `docs/payments.md`: billing in the hub's API, shared by Music and the hub. Separate merchants per product (adult content needs different processors), processor adapters, entitlements, credits, and selling as an individual. - `README.md`: links to both. Decisions are marked **Decided**; the rest are proposals, with the open ones at the end of each doc. Plan for T5DE Music and the account and payment changes it needs. Docs only; no code changes. - `docs/music.md`: an IMVU room music bot. The website is music.t5de.dev (at home); streams are radio.t5de.dev (Oracle Cloud's free tier, dhkatz/infra `music-oracle`). Covers one account system with Discord sign-in and basic accounts, the hub as an OIDC provider with Music as its first client, room ownership from linked IMVU accounts, chat commands and permissions, pluggable sources modelled on HorizonRadio's (stations, own streams, YouTube), relayed vs direct streams, and the paid tier (sell the hosting; $1.99 a month per room). - `docs/payments.md`: billing in the hub's API, shared by Music and the hub. Separate merchants per product (adult content needs different processors), processor adapters, entitlements, credits, and selling as an individual. - `README.md`: links to both. Decisions are marked **Decided**; the rest are proposals, with the open ones at the end of each doc. Co-authored-by: dhkatz <[email protected]> |