docs(payments): PayPal beside Patreon, our own checkout later
PayPal subscriptions sell exactly the pricing ($1.99 a month or $19.99 a year per room, with a quantity). We're the seller there, so the service works out EU VAT (included in the price, two pieces of country evidence, a quarterly One Stop Shop report); it sells outside the EU and the UK until those registrations take effect. The service has no website of its own: the app's pages use its API, and the browser goes through it only for redirects (link Patreon, PayPal checkout, manage). Later, our own checkout elements embedded from payments.t5de.dev, so people don't see which processor takes the payment. Staging uses PayPal's sandbox and the locked staging hub.
This commit is contained in:
1 parent
f3cc3f9f17
commit
20448abd99
2 files changed
+135
-30
No files matched your search
+13
-6
@@ -263,9 +263,9 @@ both tiers, free with limits:
|
||||
same in both tiers (**Decided**), so nothing about YouTube is for sale.
|
||||
- **The free tier is the trial**: people use it, want better audio or more listeners, and upgrade.
|
||||
|
||||
| | Free | Paid (Patreon: $1.99 a month for 1 room, $4.99 for 3) |
|
||||
| | Free | Paid ($1.99 a month per room with PayPal; Patreon: $1.99 for 1 room, $4.99 for 3) |
|
||||
| --- | --- | --- |
|
||||
| Rooms | 1 | 1 or 3, by tier, on top of the free one |
|
||||
| Rooms | 1 | As many as paid for, on top of the free one |
|
||||
| Stations and own streams | Yes (direct where possible, so they cost nothing) | Yes |
|
||||
| YouTube search and queue | Fair-use limits: queue length, songs an hour, the longest song | The same |
|
||||
| Audio | 64 kbps | 128 kbps |
|
||||
@@ -280,10 +280,17 @@ once there's usage to look at.
|
||||
|
||||
IMVU credits aren't a way to pay (**Decided**, docs/payments.md).
|
||||
|
||||
**Paying** (**Decided**: Patreon first, docs/payments.md): a Patreon membership, linked to the person's account on
|
||||
payments.t5de.dev. A Patreon member has one tier, so tiers are room bundles: "Room" ($1.99 a month, 1 room) and
|
||||
"Rooms" ($4.99, 3 rooms); the most popular community bot starts at $4.99 for one room. After Patreon's 10% and
|
||||
processing, $1.99 is about $1.59. Yearly memberships at a discount once Patreon turns them on for the page.
|
||||
**Paying** (**Decided**, docs/payments.md), from Music's Upgrade page; the payments service only redirects:
|
||||
|
||||
- **PayPal**: $1.99 a month or $19.99 a year per room, one subscription for any number of rooms. Outside the EU and
|
||||
the UK at first (VAT, docs/payments.md).
|
||||
- **Patreon**, linked to the person's account: a member has one tier, so tiers are room bundles, "Room" ($1.99 a
|
||||
month, 1 room) and "Rooms" ($4.99, 3 rooms). After Patreon's 10% and processing, $1.99 is about $1.59. Yearly
|
||||
memberships at a discount once Patreon turns them on for the page.
|
||||
- Later, our own checkout embedded in the page, whichever processor is behind it (docs/payments.md, Checkout
|
||||
elements).
|
||||
|
||||
The most popular community bot starts at $4.99 for one room.
|
||||
|
||||
The paid entitlement is `music.rooms`, a count (docs/payments.md, Concepts). The owner picks which of their rooms are
|
||||
paid on the room's page, up to the count. If the count drops (a lapse, a smaller tier), the most recently picked
|
||||
|
||||
+122
-24
@@ -1,47 +1,65 @@
|
||||
# Payments (plan)
|
||||
|
||||
Status: draft (2026-11-20). Decisions marked **Decided** were agreed in discussion; the rest are proposals. Open
|
||||
decisions are at the end.
|
||||
Status: draft (2026-11-20; PayPal added the same day). 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.
|
||||
`t5de-payments`. The first ways to pay are a Patreon membership and a PayPal subscription; later, our own checkout
|
||||
in which the processor doesn't show.
|
||||
|
||||
## 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.
|
||||
- **As little tax work as possible** (**Decided**): Patreon is the seller, so tax on its sales is its own. PayPal
|
||||
makes us the seller: EU VAT through the non-Union One Stop Shop, worked out and recorded by this service (PayPal,
|
||||
below); US sales tax only past a state's threshold.
|
||||
- **No IMVU credits** (**Decided**).
|
||||
- **No card data** anywhere of ours: the platform's own pages for joining, paying and cancelling.
|
||||
- **No card data** anywhere of ours: the processor's own pages and buttons take the payment.
|
||||
- **Apps ask one question**: how much of entitlement X does this account have? They never talk to a processor.
|
||||
- **Eventually, the processor doesn't show** (**Decided**, later): people check out in our own checkout, embedded
|
||||
from `payments.t5de.dev` in the app's page (Checkout elements, below), and which processor takes the payment is
|
||||
ours to choose. Patreon is for now.
|
||||
|
||||
## 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.
|
||||
|
||||
**Environments** (**Decided**): staging (`payments.staging.t5de.dev`) signs in through staging's hub and uses the
|
||||
processors' test modes (PayPal's sandbox); prod (`payments.t5de.dev`) uses the live ones. Staging's hub registration
|
||||
is locked, so only accounts a moderator approved can use it (docs/music.md, Kinds of account).
|
||||
|
||||
- **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}`, as `user.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.
|
||||
- **No website of its own** (**Decided**): the pages people see (Upgrade, Billing under Account, "Make this room
|
||||
paid") are the app's, built from this service's API (`GET /v1/accounts/{sub}`: entitlements, links and sources,
|
||||
for the Billing page). What the browser goes through here only redirects:
|
||||
- `/link/patreon`: signs in through the hub (at once: they're already signed in), sends them to Patreon to
|
||||
approve, and back to the app.
|
||||
- `/checkout/paypal?offer=…&rooms=…&country=…`: makes the subscription (rooms, VAT), sends them to PayPal to
|
||||
approve, and back.
|
||||
- `/manage/<source>`: to Patreon's or PayPal's own page for changing or cancelling.
|
||||
|
||||
Every redirect back goes only to a return address on the app's list (no open redirects).
|
||||
|
||||
```
|
||||
music.t5de.dev ─── link Patreon ───► payments.t5de.dev ◄── webhooks, members ──► Patreon
|
||||
music.t5de.dev ── /link, /checkout ──► payments.t5de.dev ◄── webhooks, API ──► Patreon, PayPal
|
||||
▲ │
|
||||
└──── entitlements.changed, GET ─────┘
|
||||
└─── entitlements.changed, API ─────────┘
|
||||
```
|
||||
|
||||
## 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. |
|
||||
| **Provider** | Where money comes from: `patreon`, `paypal`, 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 (Patreon; a PayPal subscription carries the `sub` itself). |
|
||||
| **Source** | One thing that grants: a Patreon membership, a PayPal subscription, a grant. Mirrored from the provider: status, tier or quantity, 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. |
|
||||
|
||||
@@ -59,8 +77,9 @@ cancelling, and pays out. The page is T5DE Music's alone and marked not for adul
|
||||
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`).
|
||||
details, and an API client in the developer portal (redirect URIs `https://payments.t5de.dev/patreon/callback` and
|
||||
`https://payments.staging.t5de.dev/patreon/callback`). Patreon has no test mode: staging uses the real page, with
|
||||
memberships of our own.
|
||||
|
||||
**Configuration, in git**: the campaign's ID and each tier's ID with what it grants:
|
||||
|
||||
@@ -108,6 +127,77 @@ 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.
|
||||
|
||||
## PayPal (**Decided**: beside Patreon)
|
||||
|
||||
A PayPal business account (a sole proprietor, "T5DE Music" on receipts) with PayPal Subscriptions. We are the seller,
|
||||
so the tax is ours (Tax, below). It sells exactly what the pricing says: **$1.99 a month or $19.99 a year per room**,
|
||||
one subscription with a quantity (3 rooms is quantity 3), which Patreon's one-tier memberships can't.
|
||||
|
||||
**Product and plans** are made through PayPal's API and kept in the configuration (they're IDs, per environment):
|
||||
|
||||
```yaml
|
||||
paypal:
|
||||
product: PROD-… # "T5DE Music Room", a service, category software
|
||||
plans:
|
||||
music.rooms.monthly: P-… # $1.99 a month per room, quantity allowed
|
||||
music.rooms.yearly: P-… # $19.99 a year per room
|
||||
```
|
||||
|
||||
Prices change through the API (`update-pricing-schemes`) without new plans; how that reaches existing subscribers
|
||||
(and the notice they're owed) is to check before the first change.
|
||||
|
||||
**Checkout** (`/checkout/paypal`): signed in, with the offer, the number of rooms and the buyer's country. The service
|
||||
makes the subscription with `custom_id` = their `sub`, the quantity, and the VAT for their country (below) as a
|
||||
plan override, then sends them to PayPal's approval page; PayPal sends them back to the app. Nothing is granted on
|
||||
the way back: only PayPal's own word (the webhook, or fetching the subscription) does.
|
||||
|
||||
**The webhook** is made through the API too, on start (as Patreon's), for `BILLING.SUBSCRIPTION.ACTIVATED`,
|
||||
`.UPDATED`, `.CANCELLED`, `.SUSPENDED`, `.EXPIRED`, `.PAYMENT.FAILED`, `PAYMENT.SALE.COMPLETED`, `.REFUNDED` and
|
||||
`.REVERSED`. Each request is verified by PayPal (`/v1/notifications/verify-webhook-signature`, with our webhook's
|
||||
ID) before anything else; then the subscription is fetched again and its account recomputed. A nightly sync fetches
|
||||
every subscription the database knows.
|
||||
|
||||
**From a subscription to an entitlement**:
|
||||
|
||||
| PayPal says | Entitlement |
|
||||
| --- | --- |
|
||||
| `ACTIVE` | `music.rooms` × quantity, until `billing_info.next_billing_time` plus 7 days' grace |
|
||||
| `SUSPENDED` (payments failed 3 times) | Kept until the grace runs out |
|
||||
| `CANCELLED`, `EXPIRED` | Until the end of the period last paid for, then none |
|
||||
| A refund or reversal of the last payment | None, at once |
|
||||
|
||||
**Where it sells**: everywhere but the EU and the UK at first; the EU once our One Stop Shop registration takes
|
||||
effect; the UK once registered with HMRC (until then people there use Patreon). The checkout asks for the country and
|
||||
refuses the ones not open yet.
|
||||
|
||||
**Fees**: about 3.49% + 49¢ (56¢ of $1.99) until PayPal enrolls the account in Dynamic Micropayments (4.99% + 9¢,
|
||||
whichever is cheaper per payment), asked of PayPal support.
|
||||
|
||||
### Tax
|
||||
|
||||
- **EU VAT** (non-Union OSS, registered in one EU country, Ireland by default): VAT at the buyer's country's rate,
|
||||
**included** in the price, so $1.99 is $1.99 everywhere. The rate table is in the configuration. Two pieces of
|
||||
evidence of the country, recorded with each subscription: what the buyer chose and their IP address's country.
|
||||
If they disagree, no sale; they're asked to check. One return a quarter, made from our own records (`vat-report
|
||||
<quarter>`), even when there were no EU sales.
|
||||
- **UK VAT**: the same, once registered with HMRC.
|
||||
- **US sales tax**: none to start. A state's tax applies only past its threshold (usually $100k of sales, in a few
|
||||
states also 200 transactions a year); the service reports sales per state, so we see one coming.
|
||||
- Elsewhere: registration only past thresholds far above our sales (Norway, Switzerland, Australia and others).
|
||||
|
||||
## Checkout elements (later)
|
||||
|
||||
Our own checkout, so people don't see which processor takes the payment and Patreon can go: the payment parts of
|
||||
the app's pages are iframes from `payments.t5de.dev/elements/…` (the offer, rooms, country and VAT, and the
|
||||
processor's own buttons or card fields inside), so the app's page never handles prices, tax or payment details.
|
||||
|
||||
- The app frames them; only the apps on a list may (`frame-ancestors`). They tell the app's page when they're done or
|
||||
need more room (`postMessage`, checked against the origin).
|
||||
- Who's paying: the hub's sign-in can't be framed (it refuses, as it should), so the app hands the element a
|
||||
short-lived token for the person (signed by the hub, for this service only). Cookies aren't in the way: the apps
|
||||
and `payments.t5de.dev` are the same site.
|
||||
- The redirects above stay, for anything that can't be embedded.
|
||||
|
||||
## Grants
|
||||
|
||||
Moderators give entitlements without money (testers, gifts, apologies): `{sub, key, quantity, until, reason, by}`,
|
||||
@@ -121,10 +211,11 @@ tier is tested before anyone pays.
|
||||
| **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. |
|
||||
| **PayPal** | Used | Above. We're the seller: VAT through the One Stop Shop. Same rules against infringing goods; known for sudden limits and holds, and for siding with buyers in digital goods disputes. |
|
||||
| Stripe directly | Not used | We'd be the seller, as with PayPal; a candidate for the checkout elements later. |
|
||||
| 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:
|
||||
A provider is an adapter behind one interface, so they run side by side and more can join:
|
||||
|
||||
```ts
|
||||
interface Provider {
|
||||
@@ -142,8 +233,10 @@ interface Provider {
|
||||
|
||||
## 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.
|
||||
- A failed renewal keeps the entitlement for 7 days past the charge date (Patreon and PayPal retry meanwhile), then
|
||||
the extra rooms drop to the free tier. Nothing is deleted; paying again brings them back.
|
||||
- A refund or chargeback ends that source's entitlement at once. Repeated chargebacks: no new PayPal checkouts for
|
||||
that account.
|
||||
- Every grant, change and revocation is in the audit log, with the event or person that caused it.
|
||||
|
||||
## Selling as an individual
|
||||
@@ -151,7 +244,8 @@ interface Provider {
|
||||
- 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.
|
||||
- Patreon is the seller, so tax on its sales is Patreon's; PayPal's sales are ours (Tax, above), with "T5DE Music"
|
||||
as the business name on receipts (some states want a trade name registered as a DBA). Income tax on both 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.
|
||||
@@ -162,18 +256,22 @@ interface Provider {
|
||||
1. **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.
|
||||
2. **Patreon**: linking, the webhook, the nightly sync; the page published.
|
||||
3. **Polar**, if it says yes.
|
||||
4. **The hub's offerings**, if it ever sells any (Processors, above).
|
||||
3. **PayPal**: checkout (redirect), the webhook, the nightly sync, VAT and its report; outside the EU and the UK
|
||||
first, the EU once the One Stop Shop registration takes effect.
|
||||
4. **Checkout elements**: our own checkout, embedded; Patreon retired once it's no longer needed.
|
||||
5. **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).
|
||||
switched off without refunds, and refunds (Patreon's; ours for PayPal).
|
||||
- A privacy policy covering what's kept (Patreon: user ID, membership status and tier; PayPal: subscription, payer
|
||||
ID, country and its evidence; no payment details).
|
||||
- The accountant's hour (Selling as an individual, above), before registering for the One Stop Shop.
|
||||
|
||||
## Open decisions
|
||||
|
||||
- Polar's answer.
|
||||
- Whether Dynamic Micropayments covers subscription renewals (asked of PayPal).
|
||||
- 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.
|
||||
Reference in new issue
Block a user