A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
docs: drop refund, card age check and store routes
Hampus145594d86791
diff --git a/fluxer_docs/src/content/docs/admin-api/enforcement.mdx b/fluxer_docs/src/content/docs/admin-api/enforcement.mdxindex f00034913..148c965e7 100644--- a/fluxer_docs/src/content/docs/admin-api/enforcement.mdx+++ b/fluxer_docs/src/content/docs/admin-api/enforcement.mdx@@ -71,8 +71,6 @@ Each route accepts these bases:| [Delete message](/admin-api/messages/#delete-message) | `holder_request`, `housekeeping` || [Delete guild](/admin-api/guilds/#delete-guild) | `enforcement`, `holder_request` |-The audit entry of each route records the basis in a `basis` metadata key.-### Feature limitsEach feature limit decision limits one feature, so ending or expiring one never touches another.@@ -105,7 +103,7 @@ The notice says the account's networks were blocked and until when, and never na### Automated decisions and the review queue-A Stripe early fraud warning or chargeback records a `purchases` limit with reason code 12, `automation` `automated`, `payment_at` set to the time of the payment, and the system user (ID 0) as `decided_by`. Fluxer never suspends or closes an account, or blocks its email, because of a payment signal. The decision is placed in the review queue until a person ends it or records a warning, suspension or closure on the same account. A won dispute ends the decision as `reversed`, with the system user as `ended_by`.+A Stripe early fraud warning records a `purchases` limit with reason code 12, `automation` `automated`, `payment_at` set to the time of the payment, and the system user (ID 0) as `decided_by`. Fluxer never suspends or closes an account, or blocks its email, because of a payment signal alone. The decision is placed in the review queue until a person ends it or records a warning, suspension or closure on the same account. A won dispute ends the decision as `reversed`, with the system user as `ended_by`.## Enforcement decision input@@ -139,7 +137,7 @@ The `X-Audit-Log-Reason` header is required on every route that takes a decisionFluxer checks ACLs before it looks anything up, so a caller without the ACL learns nothing about the messages or reports it names. Evidence needs `message:lookup`, reports need `report:view` and `report:resolve`, and `block_networks` needs `ban:ip:add` and `user:view:ip`. Each other failure is a 400 `INVALID_FORM_BODY` whose error has one of these codes.- `ENFORCEMENT_INTERNAL_NOTE_REQUIRED`: the `X-Audit-Log-Reason` header is missing-- `ENFORCEMENT_KIND_NOT_ALLOWED`: the reason code does not allow this kind, a bot is given anything other than a suspension or closure, or a restricted reason is used to delete all of an account's messages+- `ENFORCEMENT_KIND_NOT_ALLOWED`: the reason code does not allow this kind, a bot is given anything other than a suspension or closure, a restricted reason is used to delete all of an account's messages, or a self-hosted instance is given reason code 34- `ENFORCEMENT_LIMIT_NOT_ALLOWED`: the reason code does not allow this feature limit- `ENFORCEMENT_LIMIT_END_INVALID`: a reports limit ends in the past or more than 365 days from now, or another limit is given an end- `ENFORCEMENT_REPORT_REQUIRED`: `source` is `report` and no report is linkeddiff --git a/fluxer_docs/src/content/docs/http-api/billing.mdx b/fluxer_docs/src/content/docs/http-api/billing.mdxindex 3a7cf6c71..a10a70c35 100644--- a/fluxer_docs/src/content/docs/http-api/billing.mdx+++ b/fluxer_docs/src/content/docs/http-api/billing.mdx@@ -1,22 +1,22 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Billing-description: Checkout, gift purchase, age verification, refunds, and the Stripe webhook.+description: Checkout, gift purchase, and the Stripe webhook.---import RouteHeader from '@/components/RouteHeader.astro';-These routes take payment for premium, verify an account holder's age, and refund the most recent purchase. Checkout and age verification each finish on the payment provider's own pages, so those routes create the provider session and return its URL for the browser to open. [Receive Stripe webhook](#receive-stripe-webhook) takes the signed events the provider sends back. The [Premium resource](/http-api/premium/) owns entitlement state, mirrored billing data and subscription self-service.+These routes take payment for premium. Checkout finishes on the payment provider's own pages, so the checkout routes create the provider session and return its URL for the browser to open. [Receive Stripe webhook](#receive-stripe-webhook) takes the signed events the provider sends back. The [Premium resource](/http-api/premium/) owns entitlement state, mirrored billing data and subscription self-service.-A self-hosted deployment never serves age verification or the refund routes, serves the checkout routes only while billing is active, and serves [receive Stripe webhook](#receive-stripe-webhook) while Stripe is serviceable, as [deployment availability](/http-api/deployment-availability/) describes. All of them are user-only except [receive Stripe webhook](#receive-stripe-webhook).+A self-hosted deployment serves the checkout routes only while billing is active, and serves [receive Stripe webhook](#receive-stripe-webhook) while Stripe is serviceable, as [deployment availability](/http-api/deployment-availability/) describes. All of them are user-only except [receive Stripe webhook](#receive-stripe-webhook).:::note[Every response is a Fluxer object]-The responses are Fluxer redirect, eligibility, refund and acknowledgement objects. They copy only a few payment provider values, such as the identifiers on a [refund](#refund-object) and the `invoice_id` of a [refund eligibility](#refund-eligibility-object) object.+The responses are Fluxer redirect and acknowledgement objects.:::## Redirect URL object-One absolute URL that completes a billing operation in a browser. [Create subscription checkout](#create-subscription-checkout), [create gift checkout](#create-gift-checkout) and [create age verification session](#create-age-verification-session) all answer with it. The object has no session identifier, so a client sends the browser to the returned value.+One absolute URL that completes a billing operation in a browser. [Create subscription checkout](#create-subscription-checkout) and [create gift checkout](#create-gift-checkout) both answer with it. The object has no session identifier, so a client sends the browser to the returned value.### Structure@@ -36,102 +36,22 @@ One absolute URL that completes a billing operation in a browser. [Create subscr## Refund eligibility object-Whether the account's most recent purchase can still be refunded without operator involvement. When no refundable purchase was resolved, `eligible` and `cancels_subscription` are false. `invoice_id`, `invoice_amount_paid_cents`, `currency`, `paid_at` and `refund_window_expires_at` are null. `cooldown_expires_at` still reports an active cooldown unless the reason is `feature_unavailable`. A client reads `eligible` and `reason` before rendering any amount or timestamp.+The `billing.refund_eligibility` member of [premium state](/http-api/premium/#get-premium-state). A self-hosted deployment offers no self-service refunds, so `eligible` and `cancels_subscription` are false, `reason` is `feature_unavailable`, and every other field is null.### Structure| Field | Type | Description || --- | --- | --- |-| eligible | boolean | Whether the latest purchase can be refunded through [refund latest purchase](#refund-latest-purchase) |-| reason | ?string | [Refund ineligibility reason](#refund-ineligibility-reasons), or null when the purchase is eligible |-| invoice_id<sup>1</sup> | ?string | Payment provider invoice ID, or null when no refundable purchase was resolved |-| invoice_amount_paid_cents<sup>2</sup> | ?integer | Invoice amount paid in the currency minor unit |-| currency<sup>3</sup> | ?string | Lowercase provider currency of the invoice |-| paid_at<sup>4</sup> | ?ISO8601 timestamp | Time the invoice payment settled |-| refund_window_expires_at<sup>5</sup> | ?ISO8601 timestamp | End of the refund window |-| cooldown_expires_at<sup>6</sup> | ?ISO8601 timestamp | End of the account refund cooldown, or null when no cooldown is active |-| cancels_subscription<sup>7</sup> | boolean | Whether refunding the invoice also cancels the subscription that produced it |--<sup>1</sup> The first invoice among the five most recent invoices of the account's payment provider customer that is paid, has a positive amount, and resolves a payment intent or a charge--<sup>2</sup> The field name states cents, but the value is always the minor unit of the invoice currency--<sup>3</sup> Reported as `usd` when the resolved invoice has no currency of its own--<sup>4</sup> Taken from the settlement time of the resolved invoice payment, and from the invoice creation time when that payment has no settlement timestamp--<sup>5</sup> The value of `paid_at` plus exactly three days--<sup>6</sup> The account's first self-service refund time plus exactly 30 days, and null once that instant has passed--<sup>7</sup> True when the resolved invoice was produced by a subscription, which the confirmed refund then cancels immediately--### Example--```json-{- "eligible": true,- "reason": null,- "invoice_id": "in_1QaBcDeFgHiJkLmN",- "invoice_amount_paid_cents": 499,- "currency": "usd",- "paid_at": "2026-08-29T11:04:12.000Z",- "refund_window_expires_at": "2026-09-01T11:04:12.000Z",- "cooldown_expires_at": null,- "cancels_subscription": true-}-```--## Refund ineligibility reasons--| Value | Description |-| --- | --- |-| no_refundable_purchase | The account has no paid invoice with a positive amount and a resolvable payment reference among the invoices considered |-| outside_refund_window | The latest refundable purchase settled more than 3 days ago |-| cooldown_active | The account made a self-service refund less than 30 days ago |-| feature_unavailable | The deployment is self-hosted, or the payment provider is not configured, so self-service refunds are not offered |--## Refund object--The refund that [refund latest purchase](#refund-latest-purchase) created against the resolved invoice. It describes the request the provider accepted, so `status` decides whether money has moved.--### Structure--| Field | Type | Description |-| --- | --- | --- |-| invoice_id | string | Payment provider invoice ID that was refunded |-| payment_intent_id | ?string | Payment provider payment intent ID, or null when the invoice resolved only a charge |-| charge_id | ?string | Payment provider charge ID, or null when the invoice resolved only a payment intent |-| refund_id | ?string | Payment provider refund ID of the created refund |-| refunded_amount_cents<sup>1</sup> | integer | Amount refunded so far in the invoice currency minor unit |-| invoice_amount_paid_cents | integer | Amount paid on the refunded invoice in the invoice currency minor unit |-| currency<sup>2</sup> | string | Lowercase provider currency of the invoice |-| subscription_id<sup>3</sup> | ?string | Payment provider subscription that was cancelled along with the refund |-| status<sup>4</sup> | ?string | Provider status of the refund |--<sup>1</sup> Zero until the provider confirms the refund succeeded. Once confirmed it is the amount the provider accepted, which is one minor unit short of `invoice_amount_paid_cents` when the charge was paid with Pix and the invoice amount is greater than one minor unit--<sup>2</sup> Reported as `usd` when the resolved invoice has no currency of its own--<sup>3</sup> Null while the refund is still pending, and null for a one-off purchase--<sup>4</sup> The provider value, such as `pending`, `succeeded` or `failed`. Money moves only once it is `succeeded`--### Example--```json-{- "invoice_id": "in_1QaBcDeFgHiJkLmN",- "payment_intent_id": "pi_3QaBcDeFgHiJkLmN",- "charge_id": null,- "refund_id": "re_3QaBcDeFgHiJkLmN",- "refunded_amount_cents": 499,- "invoice_amount_paid_cents": 499,- "currency": "usd",- "subscription_id": "sub_1QaBcDeFgHiJkLmN",- "status": "succeeded"-}-```+| eligible | boolean | Always false |+| reason | ?string | Always `feature_unavailable` |+| invoice_id | ?string | Always null |+| invoice_amount_paid_cents | ?integer | Always null |+| currency | ?string | Always null |+| paid_at | ?ISO8601 timestamp | Always null |+| refund_window_expires_at | ?ISO8601 timestamp | Always null |+| cooldown_expires_at | ?ISO8601 timestamp | Always null |+| cancels_subscription | boolean | Always false |+| provider | ?string | Always null |## Webhook received object@@ -164,13 +84,13 @@ Creates a recurring premium checkout session and returns a [redirect URL](#redir- An unclaimed account returns 400 `UNCLAIMED_ACCOUNT_CANNOT_MAKE_PURCHASES`.- An unverified email address returns 403 `PURCHASE_EMAIL_VERIFICATION_REQUIRED`.- The purchase-disabled premium flag returns 403 `PREMIUM_PURCHASE_BLOCKED` with the reason `purchase_disabled`.-- A lifetime Visionary account cannot buy a recurring subscription and returns 403 `PREMIUM_PURCHASE_BLOCKED` with the reason `lifetime`.-- An account with an active [in-app purchase](/http-api/in-app-purchases/) subscription returns the same code with the reason `existing_subscription` and the store in the top-level `provider` member. Fluxer never converts this refusal.+- An open payment dispute the account made returns 403 `PREMIUM_PURCHASE_BLOCKED` with the reason `payment_dispute_open`, for a subscription and a gift alike.+- A lifetime premium account cannot buy a recurring subscription and returns 403 `PREMIUM_PURCHASE_BLOCKED` with the reason `lifetime`.- An account whose payment provider customer already holds a subscription in the `active`, `trialing`, `past_due`, `unpaid`, `incomplete` or `paused` state returns the same code with the reason `existing_subscription`, unless Fluxer converts the purchase into a scheduled billing cycle change, as described below.`reason` is a top-level member of the error response, and an `existing_subscription` refusal also has the blocking status in the top-level `subscription_status` member.-Fluxer evaluates the lifetime refusal before the unclaimed account, unverified email and purchase flag refusals, so a lifetime Visionary account submitting a recurring price always receives the reason `lifetime` whatever its account state.+Fluxer evaluates the lifetime refusal before the unclaimed account, unverified email and purchase flag refusals, so a lifetime premium account submitting a recurring price always receives the reason `lifetime` whatever its account state.An account already holding an `active` or `trialing` subscription can submit a registered recurring non-gift price for the other billing cycle. Fluxer then schedules a billing cycle change to the submitted cycle at the end of the current period. That is exactly what [change subscription billing cycle](/http-api/premium/#change-subscription-billing-cycle) with `effective_at` set to `period_end` does. The response is 200 with `url` set to the Fluxer premium callback URL.@@ -193,7 +113,7 @@ The conversion requires a stored billing cycle on the account that differs from<sup>3</sup> Considered only when the effective country is inside the European Union or European Economic Area. The effective country is the request-time geolocation country, then the client-observed country, then the pricing country-<sup>4</sup> `pix` requires a BRL recurring price and `upi` requires an INR recurring price. Both are rejected for a gift price or a non-recurring price with 400 `STRIPE_INVALID_PRODUCT_CONFIGURATION`. A recurring BRL price from the Fluxer price catalogue always checks out with `pix`, whatever this field says. A catalogue the operator manages has no such rule+<sup>4</sup> `pix` requires a BRL recurring price and `upi` requires an INR recurring price. Both are rejected for a gift price or a non-recurring price with 400 `STRIPE_INVALID_PRODUCT_CONFIGURATION`.### Response@@ -226,10 +146,10 @@ Creates a one-off premium gift checkout session and returns a [redirect URL](#re### Limitations-- The claimed account, verified email and purchase flag requirements of [create subscription checkout](#create-subscription-checkout) apply unchanged, with the same codes.+- The claimed account, verified email, purchase flag and open payment dispute requirements of [create subscription checkout](#create-subscription-checkout) apply unchanged, with the same codes.- The submitted price is a registered gift price for the resolved country catalogue, so a recurring price returns 400 `STRIPE_INVALID_PRODUCT_CONFIGURATION`.-Neither the lifetime block nor the existing subscription block applies here, so a lifetime Visionary account can buy gifts.+Neither the lifetime block nor the existing subscription block applies here, so a lifetime premium account can buy gifts.### JSON body@@ -265,112 +185,6 @@ The returned URL opens a one-off checkout. The [gift](/http-api/gifts/#gift-obje3 requests per minute for each authenticated user, on the `stripe:checkout:gift` bucket.-## Create age verification session--<RouteHeader method="POST" path="/v1/users/@me/age-verification" />--Creates a setup mode session that verifies the account holder controls a credit card, and returns a [redirect URL](#redirect-url-object) object. It takes no request body.--### Limitations--- A deployment with no configured provider returns 400 `STRIPE_PAYMENT_NOT_AVAILABLE` before any other check.-- An account that already has the age-verified adult flag then returns 400 `AGE_VERIFICATION_ALREADY_VERIFIED`.--:::note[Only a credit card satisfies verification]-The session requests 3-D Secure authentication on the card and takes no payment. Verification succeeds only when the resulting payment method reports credit funding, and a debit or prepaid card leaves the account unverified without an error here.-:::--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [redirect URL](#redirect-url-object) object | The verification session was created |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The account is already age verified, or the provider is not configured or rejected the request |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists |--<sup>1</sup> A rejected request returns `STRIPE_ERROR`--### Side effects--Adult age verification is granted only after [receive Stripe webhook](#receive-stripe-webhook) processes the matching completion event and confirms a credit card. The grant sets the age-verified adult flag and sends [User Update](/gateway/events/#user-update) to every session owned by the account.--### Rate limit--3 requests per minute for each authenticated user, on the `age_verification` bucket.--## Get refund eligibility--<RouteHeader method="GET" path="/v1/premium/refund-eligibility" />--Returns the [refund eligibility](#refund-eligibility-object) object for the authenticated account.--A deployment with no configured payment provider answers with `eligible` false and the reason `feature_unavailable`. Otherwise the operation lists the five most recent invoices for the account's payment provider customer and selects the first that is paid, has a positive amount, and resolves a payment intent or a charge.--A failed payment-history lookup or an account with no payment history reports no refundable purchase.--:::note[The same object appears inside premium state]-[Get premium state](/http-api/premium/#get-premium-state) also returns `billing.refund_eligibility`, which Fluxer computes from the invoices it has stored. This endpoint reads the invoices from the payment provider, so the premium state value can be older.-:::--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [refund eligibility](#refund-eligibility-object) object | The eligibility state was returned |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists |--### Rate limit--30 requests per minute for each authenticated user, on the `stripe:refund:eligibility` bucket.--## Refund latest purchase--<RouteHeader method="POST" path="/v1/premium/refund-latest" />--Refunds the account's most recent eligible purchase and returns the [refund](#refund-object) object.--### Limitations--- A deployment with no configured payment provider returns 400 `STRIPE_PAYMENT_NOT_AVAILABLE`.-- An account with no selectable invoice returns 400 `STRIPE_NO_PURCHASE_HISTORY`.-- A purchase that settled more than 3 days ago returns 403 `STRIPE_REFUND_OUTSIDE_WINDOW`.-- An account whose 30-day cooldown is still running returns 403 `STRIPE_REFUND_COOLDOWN_ACTIVE`.--The same invoice selection as [get refund eligibility](#get-refund-eligibility) applies.--Repeating the request returns the same provider refund. After a refund that the provider reports as failed or cancelled, the account can attempt the refund again.--:::note[A Pix refund is short one minor unit]-When the resolved charge was paid with Pix and the invoice amount is greater than one minor unit, the requested refund is the invoice amount minus one minor unit.-:::--:::danger[A confirmed refund is irreversible]-Once the provider confirms the refund succeeded, the subscription that produced the invoice is cancelled immediately with no proration and no final invoice, and the 30-day cooldown begins. Neither effect can be undone through this API.-:::--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [refund](#refund-object) object | The refund was created, or the request repeats an earlier refund of this invoice and returns that refund |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The account has no refundable purchase, or the payment provider cannot refund it |-| 403 | [error response](/http-api/#error-response) | The purchase is outside the refund window, or the refund cooldown is active |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists |--<sup>1</sup> The payment provider is not configured, or the payment method could not be determined, or the provider rejected the refund. The last two return `STRIPE_ERROR`--### Side effects--The operation creates a refund for the invoice amount paid, reduced by one minor unit in the Pix case, with the reason `requested_by_customer`.--A refund the provider confirms as succeeded in the same call cancels the subscription that produced the invoice and starts the 30-day cooldown from that moment. A refund still reported as pending or as awaiting further action does neither. [Receive Stripe webhook](#receive-stripe-webhook) cancels the subscription and starts the cooldown when it processes the provider event that confirms the refund.--A confirmed refund that cancels the current subscription updates the account's premium state and sends [User Update](/gateway/events/#user-update) to every account session.--### Rate limit--3 requests per minute for each authenticated user, on the `stripe:refund:latest` bucket.-## Receive Stripe webhook<RouteHeader method="POST" path="/v1/stripe/webhook" unauthenticated />@@ -406,7 +220,7 @@ A proxy that re-encodes, reorders or pretty-prints the payload invalidates the sThe response comes before processing, and a redelivered event is applied once.-Accepted events update payment, subscription, gift, donation and age-verification results. Resulting account changes reach connected sessions as [User Update](/gateway/events/#user-update).+Accepted events update payment, subscription, gift and dispute results. Resulting account changes reach connected sessions as [User Update](/gateway/events/#user-update).### Rate limitdiff --git a/fluxer_docs/src/content/docs/http-api/deployment-availability.md b/fluxer_docs/src/content/docs/http-api/deployment-availability.mdindex 65a12555c..39630fca0 100644--- a/fluxer_docs/src/content/docs/http-api/deployment-availability.md+++ b/fluxer_docs/src/content/docs/http-api/deployment-availability.md@@ -1,25 +1,24 @@---# SPDX-License-Identifier: AGPL-3.0-or-latertitle: Deployment availability-description: The routes a self-hosted deployment may not serve and the instance flags that decide them.+description: The routes a self-hosted deployment serves only while premium or billing is on, and the instance flags that decide them.----The routes listed under [Conditional routes](#conditional-routes) depend on the deployment. The deployment Fluxer hosts serves all of them. A self-hosted deployment serves some of them only while its operator runs a premium tier or sells it, and never serves the rest. Both deployments run the same release, and most of the HTTP API is identical on both.+The routes listed under [Conditional routes](#conditional-routes) depend on the instance. A self-hosted deployment serves them only while its operator runs a premium tier or sells it.-When a self-hosted deployment does not serve one of these routes, a request to it returns 404 `NOT_FOUND` with no feature-specific code, so a caller cannot tell an unavailable route from an unrecognised path.+When a deployment does not serve one of these routes, a request to it returns 404 `NOT_FOUND` with no feature-specific code, so a caller cannot tell an unavailable route from an unrecognised path.Credentials, permissions, premium state and OAuth2 scopes do not change route availability. Read the deployment kind and the premium flags from instance discovery.## Deployment kind-Every deployment reports its kind in `self_hosted` on the [instance features object](/http-api/instance/#instance-features-object). The unauthenticated [instance discovery document](/http-api/instance/#get-instance-discovery) publishes it before a client holds any credential. A hosted deployment serves every route below whatever the other flags say.+Every deployment reports its kind in `self_hosted` on the [instance features object](/http-api/instance/#instance-features-object). The unauthenticated [instance discovery document](/http-api/instance/#get-instance-discovery) publishes it before a client holds any credential.On a self-hosted deployment, three flags on the same object decide which routes below are served. All three are computed on each request, so an operator's change applies without a restart.- `premium_enabled` is true while the instance [premium mode](/admin-api/instance/#premium-modes) is `mirror`. The routes under [Served in the mirror premium mode](#served-in-the-mirror-premium-mode) are served only then.- `stripe_enabled` is true while billing is active. Billing is active when the operator has switched it on, set a Stripe secret key, and set a monthly and a yearly price for at least one currency, and `premium_enabled` is true. The routes under [Served while billing is active](#served-while-billing-is-active) are served only then.- `stripe_serviceable` is true while a Stripe secret key is set and `premium_enabled` is true. The routes under [Served while Stripe is serviceable](#served-while-stripe-is-serviceable) are served only then, so existing subscriptions can still be managed after the operator stops sales.-- The routes under [Never served on a self-hosted deployment](#never-served-on-a-self-hosted-deployment) are never served.[Receive Stripe webhook](/http-api/billing/#receive-stripe-webhook) also needs a Stripe webhook secret.@@ -27,12 +26,6 @@ On a self-hosted deployment, three flags on the same object decide which routes`stripe_enabled`, `stripe_serviceable` and `premium_enabled` do not promise that a provider-dependent operation succeeds.:::-When billing is switched off or no Stripe secret key is configured on a hosted deployment, the answer depends on the operation. An operation that has to reach the provider fails with 400 `STRIPE_PAYMENT_NOT_AVAILABLE`, and [Receive Stripe webhook](/http-api/billing/#receive-stripe-webhook) fails with 400 `STRIPE_WEBHOOK_NOT_AVAILABLE`. These read operations report the absence in a 200 body instead:--- [Get refund eligibility](/http-api/billing/#get-refund-eligibility) reports `eligible` false with the reason `feature_unavailable`.-- [Get current subscription price](/http-api/premium/#get-current-subscription-price) reports null.-- [Get price IDs](/http-api/premium/#get-price-ids) reports the configured price IDs with every amount null.-## Conditional routes### Served in the mirror premium mode@@ -64,34 +57,12 @@ When billing is switched off or no Stripe secret key is configured on a hosted d| POST | /v1/premium/change-subscription | [Change subscription billing cycle](/http-api/premium/#change-subscription-billing-cycle) || POST | /v1/premium/cancel-pending-subscription-change | [Cancel pending subscription change](/http-api/premium/#cancel-pending-subscription-change) |-### Never served on a self-hosted deployment--| Method | Route | Operation |-| --- | --- | --- |-| POST | /v1/donations/request-link | [Request donation management link](/http-api/donations/#request-donation-management-link) |-| GET | /v1/donations/manage | [Manage donation](/http-api/donations/#manage-donation) |-| POST | /v1/donations/checkout | [Create donation checkout](/http-api/donations/#create-donation-checkout) |-| POST | /v1/users/@me/age-verification<sup>1</sup> | [Create age verification session](/http-api/billing/#create-age-verification-session) |-| GET | /v1/premium/refund-eligibility<sup>4</sup> | [Get refund eligibility](/http-api/billing/#get-refund-eligibility) |-| POST | /v1/premium/refund-latest | [Refund latest purchase](/http-api/billing/#refund-latest-purchase) |-| POST | /v1/premium/switch-to-list-price | [Switch subscription to the list price](/http-api/premium/#switch-subscription-to-the-list-price) |-| POST | /v1/premium/visionary/rejoin | [Rejoin Visionary guild](/http-api/premium/#rejoin-visionary-guild) |-| GET | /v1/premium/store | [Get in-app purchase context](/http-api/in-app-purchases/#get-in-app-purchase-context) |-| POST | /v1/premium/store/app-store/transactions | [Claim App Store transaction](/http-api/in-app-purchases/#claim-app-store-transaction) |-| POST | /v1/premium/store/google-play/purchases | [Claim Google Play purchase](/http-api/in-app-purchases/#claim-google-play-purchase) |-| GET | /v1/premium/store/purchases | [List in-app purchases](/http-api/in-app-purchases/#list-in-app-purchases) |-| DELETE | /v1/premium/store/purchases/{purchase_id} | [Release in-app subscription](/http-api/in-app-purchases/#release-in-app-subscription) |--<sup>1</sup> These are the only `/users/@me` routes a self-hosted deployment may not serve+<sup>1</sup> This is the only `/users/@me` route a self-hosted deployment may not serve<sup>2</sup> The webhook takes no credential and is authenticated by the provider signature header alone<sup>3</sup> The same object appears as `billing.current_subscription_price` on [Get premium state](/http-api/premium/#get-premium-state), which every deployment serves-<sup>4</sup> The same object appears as `billing.refund_eligibility` on [Get premium state](/http-api/premium/#get-premium-state), which every deployment serves, and there a self-hosted deployment reports `eligible` false with the reason `feature_unavailable`--The two [store notification webhooks](/http-api/in-app-purchases/#store-notification-webhooks) are never served on a self-hosted deployment either.-## Registered routes that resolve differentlyA route every deployment registers can still produce a different answer on a self-hosted instance. Each operation page documents that difference.@@ -100,4 +71,4 @@ Premium state is the clearest case. Every deployment registers [Get premium statThe other instance feature flags published by [instance discovery](/http-api/instance/#instance-features-object) work the same way. `voice_enabled`, `presigned_attachment_uploads`, `emails_enabled`, and `discovery_enabled` each report whether a capability is switched on. The routes for that capability stay registered when the flag is false, so a client reads the flag before it uses them.-`account_identity` is the same kind of flag. Every deployment registers the email routes and the username-only routes alike. A `username` deployment answers the email routes with 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`, and an `email` deployment answers the username-only routes with 400 `USERNAME_SIGN_IN_ONLY`. A hosted deployment is always `email`.+`account_identity` is the same kind of flag. Every deployment registers the email routes and the username-only routes alike. A `username` deployment answers the email routes with 400 `EMAIL_UNAVAILABLE_ON_INSTANCE`, and an `email` deployment answers the username-only routes with 400 `USERNAME_SIGN_IN_ONLY`.diff --git a/fluxer_docs/src/content/docs/http-api/in-app-purchases.mdx b/fluxer_docs/src/content/docs/http-api/in-app-purchases.mdxdeleted file mode 100644index 03b44c3de..000000000--- a/fluxer_docs/src/content/docs/http-api/in-app-purchases.mdx+++ /dev/null@@ -1,455 +0,0 @@-----# SPDX-License-Identifier: AGPL-3.0-or-later-title: In-app purchases-description: App Store and Google Play purchases, the claim routes the mobile apps call, and the store notification webhooks.------import RouteHeader from '@/components/RouteHeader.astro';--The mobile apps sell premium through the App Store and Google Play. The store takes the payment, and the app then hands the purchase to Fluxer through a claim route. Fluxer verifies the purchase with the store, links it to the account, and applies it to the account's premium state. The stores also send [notifications](#store-notification-webhooks) for renewals, expiries and refunds, so a purchase stays current without the app.--A subscription purchase grants the same premium as a [Stripe subscription](/http-api/billing/#create-subscription-checkout). A gift purchase mints one [gift](/http-api/gifts/#gift-object) code. [Get premium state](/http-api/premium/#get-premium-state) reports the active store subscription in `store`, and names the platform that owns the account's recurring subscription in `subscription_provider`. A client manages the subscription only on that platform, so an app does not offer its own management for a `stripe` subscriber.--Every route on this page except the store notification webhooks is user-only. A self-hosted deployment never serves any of them, as [deployment availability](/http-api/deployment-availability/) describes.--| Object | Purpose |-| --- | --- |-| [In-app purchase context](#in-app-purchase-context-object) | The account token and the products the apps may sell |-| [Store purchase](#store-purchase-object) | One App Store or Google Play purchase linked to the account |-| [Store purchase claim](#store-purchase-claim-object) | The result of a claim |--## Store providers--| Value | Description |-| --- | --- |-| app_store | Apple App Store, with StoreKit 2 in the app |-| google_play | Google Play, with Play Billing in the app |--## Store slots--Each configured store product sells one Fluxer product, called its slot.--| Value | Description |-| --- | --- |-| monthly | Premium subscription billed every month |-| yearly | Premium subscription billed every year |-| gift_1_month | One gift code for one month of premium |-| gift_1_year | One gift code for one year of premium |--## Store purchase states--| Value | Description |-| --- | --- |-| pending | The store has not taken the payment yet |-| active | The subscription is paid and renews |-| grace | The renewal payment failed and the store grace period is running |-| billing_retry | The renewal payment failed and the store is retrying without grace |-| on_hold | Google Play has suspended the subscription after a failed payment |-| paused | The subscriber paused the subscription in Google Play |-| canceled | The subscription is paid until `expires_at` and will not renew |-| expired | The subscription has ended |-| revoked | The store refunded or revoked the subscription |-| superseded | A newer Google Play purchase replaced this one |-| purchased | The gift is paid and its code is not minted yet |-| fulfilled | The gift code is minted |-| refunded | The store refunded the gift |--Only `active`, `grace` and `canceled` can grant premium.--## Purchase blocked reasons--| Value | Description |-| --- | --- |-| lifetime | The account holds lifetime Visionary premium |-| existing_subscription | The account already has an active subscription |-| purchase_disabled | Purchases are disabled for the account |--## In-app purchase context object--What an app needs before it shows a paywall. [Get in-app purchase context](#get-in-app-purchase-context) returns it.--### Structure--| Field | Type | Description |-| --- | --- | --- |-| app_account_token<sup>1</sup> | string | The account token, a lowercase UUID |-| app_store | [App Store settings](#app-store-settings-object) object | App Store purchase settings |-| google_play | [Google Play settings](#google-play-settings-object) object | Google Play purchase settings |-| purchase_blocked_reason<sup>2</sup> | ?string | [Purchase blocked reason](#purchase-blocked-reasons), or null |-| blocking_provider<sup>3</sup> | ?string | Provider of the blocking subscription, or null |--<sup>1</sup> Stable for the account. An App Store purchase passes it as `appAccountToken`, and a Google Play purchase passes it as `obfuscatedAccountId`. Fluxer links a purchase that has the token to the account even when the store notification arrives before the claim--<sup>2</sup> Null when the account can buy a subscription. Gift products stay on sale whatever the value is--<sup>3</sup> Either `stripe`, `app_store` or `google_play`. It has a value only when the reason is `existing_subscription`--### Example--```json-{- "app_account_token": "0f7c2a1e-5b3d-4c8e-9a61-2d4f8b7e3c10",- "app_store": {- "enabled": true,- "bundle_ids": ["com.fluxer"],- "products": [- {"product_id": "com.fluxer.plutonium.monthly", "slot": "monthly"},- {"product_id": "com.fluxer.gift.1month", "slot": "gift_1_month"}- ]- },- "google_play": {- "enabled": true,- "package_names": ["com.fluxer"],- "products": [- {"product_id": "plutonium", "base_plan_id": "monthly", "slot": "monthly"},- {"product_id": "gift_1_month", "base_plan_id": null, "slot": "gift_1_month"}- ]- },- "purchase_blocked_reason": null,- "blocking_provider": null-}-```--## App Store settings object--The App Store purchases the deployment accepts. When the App Store is not set up, `enabled` is false and both arrays are empty.--### Structure--| Field | Type | Description |-| --- | --- | --- |-| enabled | boolean | Whether App Store purchases are accepted |-| bundle_ids | array[string] | App bundle IDs whose purchases are accepted |-| products | array[[App Store product](#app-store-product-object) object] | Products on sale |--## App Store product object--### Structure--| Field | Type | Description |-| --- | --- | --- |-| product_id | string | App Store product ID |-| slot | string | [Store slot](#store-slots) |--## Google Play settings object--The Google Play purchases the deployment accepts. When Google Play is not set up, `enabled` is false and both arrays are empty.--### Structure--| Field | Type | Description |-| --- | --- | --- |-| enabled | boolean | Whether Google Play purchases are accepted |-| package_names | array[string] | App package names whose purchases are accepted |-| products | array[[Google Play product](#google-play-product-object) object] | Products on sale |--## Google Play product object--A subscription product has one entry for each base plan on sale.--### Structure--| Field | Type | Description |-| --- | --- | --- |-| product_id | string | Google Play product ID |-| base_plan_id | ?string | Base plan ID, or null for a one-time product |-| slot | string | [Store slot](#store-slots) |--## Store purchase object--One purchase as Fluxer last read it from the store. It never exposes purchase tokens, transaction IDs or the account token.--### Structure--| Field | Type | Description |-| --- | --- | --- |-| id | snowflake | The ID of the store purchase |-| provider | string | [Store provider](#store-providers) |-| kind | string | Either `subscription` or `gift` |-| slot | string | [Store slot](#store-slots) |-| product_id | string | Store product ID |-| environment<sup>1</sup> | string | Either `production` or `sandbox` |-| state | string | [Store purchase state](#store-purchase-states) |-| entitled<sup>2</sup> | boolean | Whether the purchase grants premium now |-| expires_at | ?ISO8601 timestamp | End of the paid period, or null for a gift |-| entitled_until<sup>3</sup> | ?ISO8601 timestamp | End of access from this purchase |-| will_renew | ?boolean | Whether the subscription renews, or null for a gift |-| gift_code | ?string | Gift code minted by a gift purchase, or null |-| created_at | ISO8601 timestamp | The time Fluxer first saw the purchase |--<sup>1</sup> `sandbox` is an App Store sandbox purchase or a Google Play license test purchase--<sup>2</sup> A `sandbox` purchase is false unless the account is allowed test purchases on the deployment--<sup>3</sup> The grace period end while `state` is `grace`, otherwise `expires_at`. Null for a gift and for a purchase that grants nothing--### Example--```json-{- "id": "1501203318237184000",- "provider": "app_store",- "kind": "subscription",- "slot": "monthly",- "product_id": "com.fluxer.plutonium.monthly",- "environment": "production",- "state": "active",- "entitled": true,- "expires_at": "2026-10-29T09:00:00.000Z",- "entitled_until": "2026-10-29T09:00:00.000Z",- "will_renew": true,- "gift_code": null,- "created_at": "2026-09-29T09:00:00.000Z"-}-```--## Store purchase claim object--### Structure--| Field | Type | Description |-| --- | --- | --- |-| purchase | [store purchase](#store-purchase-object) object | The claimed purchase |-| gift_code<sup>1</sup> | ?string | Gift code minted by a gift purchase, or null |--<sup>1</sup> The same value as `purchase.gift_code`. Null for a subscription and for a gift the store has not finished charging--### Example--```json-{- "purchase": {- "id": "1501203318237184001",- "provider": "google_play",- "kind": "gift",- "slot": "gift_1_month",- "product_id": "gift_1_month",- "environment": "production",- "state": "fulfilled",- "entitled": true,- "expires_at": null,- "entitled_until": null,- "will_renew": null,- "gift_code": "q7Xr2mPz9LkT4vBn8cWd3HsYf6JaE1Gu",- "created_at": "2026-09-29T09:00:00.000Z"- },- "gift_code": "q7Xr2mPz9LkT4vBn8cWd3HsYf6JaE1Gu"-}-```--## Get in-app purchase context--<RouteHeader method="GET" path="/v1/premium/store" />--Returns the [in-app purchase context](#in-app-purchase-context-object) object for the authenticated account.--The blocked reason is decided in a fixed order. A lifetime Visionary account reports `lifetime`, then the purchase-disabled premium flag reports `purchase_disabled`, then an active store subscription reports `existing_subscription` with that store, and then an active Stripe subscription reports `existing_subscription` with `stripe`.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [in-app purchase context](#in-app-purchase-context-object) object | The context was returned |--### Side effects--The first read creates the account token.--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `store:context` bucket.--## Claim App Store transaction--<RouteHeader method="POST" path="/v1/premium/store/app-store/transactions" />--Verifies a StoreKit 2 signed transaction, links the purchase to the authenticated account, applies it, and returns a [store purchase claim](#store-purchase-claim-object) object. Repeating the claim for the same purchase returns the same result.--The app finishes the transaction after a 200 response or any 400 or 403 error listed under limitations. It leaves the transaction unfinished after a 429, a 503 `STORE_BILLING_UNAVAILABLE`, another 5xx or a network failure. StoreKit then delivers the transaction again, so the claim can be retried later.--### Limitations--- A transaction that fails verification, is for an unknown product or app, or comes from Xcode or local testing returns 400 `STORE_PURCHASE_INVALID`.-- A gift bought in a quantity above one mints no gift code and returns 400 `STORE_PURCHASE_INVALID`.-- A purchase already linked to another live account returns 403 `STORE_PURCHASE_OWNED_BY_OTHER_ACCOUNT`. So does a purchase whose account token belongs to another live account.-- A sandbox purchase on an account that is not allowed test purchases returns 403 `STORE_PURCHASE_SANDBOX_NOT_ENTITLED`.-- A subscription claimed by a lifetime Visionary account returns 403 `PREMIUM_PURCHASE_BLOCKED` with the reason `lifetime` and the store in the top-level `provider` member.-- A deployment without the App Store set up, or an App Store that cannot be reached, returns 503 `STORE_BILLING_UNAVAILABLE`.--After a test purchase or lifetime refusal the purchase is still linked to the account. It grants nothing.--A purchase shared through Family Sharing is linked only through this route.--### JSON body--| Field | Type | Description |-| --- | --- | --- |-| signed_transaction | string | The signed transaction from StoreKit 2 (1-32768 characters) |--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [store purchase claim](#store-purchase-claim-object) object | The purchase was verified and linked |-| 400 | [error response](/http-api/#error-response) | The transaction was not accepted |-| 403 | [error response](/http-api/#error-response) | The purchase belongs to another account, or it cannot grant premium to this account |-| 503 | [error response](/http-api/#error-response) | The App Store is unavailable |--### Side effects--Fluxer reads the purchase from the App Store. A subscription that grants premium updates the account's premium state, and a gift purchase mints its gift code once. A changed premium state sends [User Update](/gateway/events/#user-update) to every account session.--When the purchase has no account token, or has one that belongs to no live account, Fluxer sets the claiming account's token on it.--### Rate limit--20 requests per minute for each authenticated user, on the `store:claim:app_store` bucket.--## Claim Google Play purchase--<RouteHeader method="POST" path="/v1/premium/store/google-play/purchases" />--Verifies a Google Play purchase token, links the purchase to the authenticated account, applies it, and returns a [store purchase claim](#store-purchase-claim-object) object. Repeating the claim for the same purchase returns the same result.--Fluxer acknowledges the purchase with Google Play. The app does not need to acknowledge it.--### Limitations--- A token that Google Play does not recognise, a product that is not on sale, a product that does not match the token, and a package name that is not accepted all return 400 `STORE_PURCHASE_INVALID`.-- The ownership, test purchase and lifetime refusals of [claim App Store transaction](#claim-app-store-transaction) apply unchanged, with the same codes.-- A deployment without Google Play set up, or a Google Play that cannot be reached, returns 503 `STORE_BILLING_UNAVAILABLE`.--A lifetime Visionary account that buys a subscription through Google Play is refunded. So is a gift bought through Google Play in a quantity above one.--### JSON body--| Field | Type | Description |-| --- | --- | --- |-| purchase_token | string | Purchase token from Play Billing (1-1024 characters) |-| product_id | string | Google Play product ID of the purchase (1-256 characters) |-| package_name?<sup>1</sup> | string | Package name of the app that made the purchase (1-256 characters) |--<sup>1</sup> One of `google_play.package_names` from the [in-app purchase context](#in-app-purchase-context-object). Defaults to the first accepted package--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [store purchase claim](#store-purchase-claim-object) object | The purchase was verified and linked |-| 400 | [error response](/http-api/#error-response) | The purchase was not accepted |-| 403 | [error response](/http-api/#error-response) | The purchase belongs to another account, or it cannot grant premium to this account |-| 503 | [error response](/http-api/#error-response) | Google Play is unavailable |--### Side effects--Fluxer reads the purchase from Google Play. A subscription that grants premium updates the account's premium state, and a gift purchase mints its gift code once and is then consumed. A changed premium state sends [User Update](/gateway/events/#user-update) to every account session.--A purchase that replaces an earlier subscription, such as an upgrade, takes over that subscription's account link. The earlier purchase becomes `superseded`.--### Rate limit--20 requests per minute for each authenticated user, on the `store:claim:google_play` bucket.--## List in-app purchases--<RouteHeader method="GET" path="/v1/premium/store/purchases" />--Returns an array of the [store purchase](#store-purchase-object) objects linked to the authenticated account, newest first.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | array[[store purchase](#store-purchase-object) object] | The purchases were returned |--### Rate limit--30 requests per 10 seconds for each authenticated user, on the `store:purchases:list` bucket.--## Release in-app subscription--<RouteHeader method="DELETE" path="/v1/premium/store/purchases/{purchase_id}" mfa />--Unlinks a store subscription from the authenticated account and returns 204 with an empty body. Requires sudo mode. Another account can then claim the subscription.--Releasing does not cancel the subscription. The subscriber cancels it in the store.--### Limitations--- A purchase that is not linked to the account returns 404 `UNKNOWN_STORE_PURCHASE`.-- A gift purchase cannot be released and returns 400 `STORE_PURCHASE_INVALID`.--### Path parameters--| Field | Type | Description |-| --- | --- | --- |-| purchase_id | snowflake | The ID of the store purchase |--### Request headers--| Field | Type | Description |-| --- | --- | --- |-| X-Fluxer-Sudo-Mode-JWT? | string | Existing sudo mode proof |--### JSON body--The body is the [sudo verification fields](/http-api/guilds/#sudo-verification-fields). A request that already has a valid proof can omit it.--| Field | Type | Description |-| --- | --- | --- |-| password? | string | Current account password |-| mfa_method? | string | MFA method, either `totp` or `webauthn` |-| mfa_code? | string | Authenticator code or unconsumed backup code when the method is `totp` (1-32 characters) |-| webauthn_response? | [WebAuthn assertion](/http-api/authentication/#webauthn-assertion) object | Assertion when the method is `webauthn` |-| webauthn_challenge? | string | Challenge bound to the WebAuthn assertion |--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 204 | empty | The subscription was released |-| 400 | [error response](/http-api/#error-response) | The purchase is a gift, or the sudo proof was rejected |-| 403 | [error response](/http-api/#error-response) | Sudo mode is required and returns `SUDO_MODE_REQUIRED` |-| 404 | [error response](/http-api/#error-response) | The purchase is not linked to the account |--### Side effects--The account stops receiving premium from the subscription, and a changed premium state sends [User Update](/gateway/events/#user-update) to every account session.--### Rate limit--5 requests per minute for each authenticated user, on the `store:purchases:release` bucket.--## Store notification webhooks--The stores call these two routes. No client calls them, and they have no OpenAPI entry. Both routes are served only on the hosted deployment, and both answer 503 `STORE_BILLING_UNAVAILABLE` while their store is not set up.--Fluxer reads the purchase from the store again after each notification, and a redelivered notification is applied once. A Google Play voided purchase is the one notification that changes a purchase by itself. It marks a gift `refunded`, or a subscription `revoked` when the voided order is its latest order.--When a gift is refunded, Fluxer revokes its gift code and takes the gift time back from the account that redeemed it. When the store reverses the refund, the gift code and its gift time come back.--Fluxer also reads the App Store notification history and the Google Play voided purchases once a day, so a notification that was missed is still applied.--### App Store Server Notifications--`POST /webhooks/app-store` receives App Store Server Notifications V2. The body is `{"signedPayload": "..."}`, signed by Apple. Fluxer verifies the signature before it answers.--| Status | Condition |-| --- | --- |-| 200 | The notification was verified and queued |-| 401 | The body or its signature was rejected and returns `STORE_NOTIFICATION_UNAUTHORIZED` |-| 503 | The App Store is not set up |--300 requests per minute for each client IP address, on the `store:webhook:app_store` bucket. The bucket is exempt from the global bucket.--### Google Play real-time developer notifications--`POST /webhooks/google-play` receives real-time developer notifications as Pub/Sub push messages. Each message is authenticated by a Google-signed token in the `Authorization` header, whose audience and service account the deployment configures.--| Status | Condition |-| --- | --- |-| 204 | The message was queued, or it was not a Pub/Sub message and was dropped |-| 401 | The token was rejected and returns `STORE_NOTIFICATION_UNAUTHORIZED` |-| 503 | Google Play is not set up |--300 requests per minute for each client IP address, on the `store:webhook:google_play` bucket. The bucket is exempt from the global bucket.diff --git a/fluxer_docs/src/content/docs/http-api/index.md b/fluxer_docs/src/content/docs/http-api/index.mdindex 109fc0ebd..9725d276a 100644--- a/fluxer_docs/src/content/docs/http-api/index.md+++ b/fluxer_docs/src/content/docs/http-api/index.md@@ -87,8 +87,6 @@ An OAuth2 bearer access token is accepted only where a route opts in, and the re## Standard request headers-These headers are accepted across resources. An operation-specific header is documented in that operation's request header table.-| Field | Type | Description || --- | --- | --- || Authorization? | string | The single credential for an authenticated request, in one of the [accepted schemes](/authentication/#authorization-schemes) |@@ -173,7 +171,7 @@ A global denial has `Retry-After`, `X-RateLimit-Scope`, and `X-RateLimit-Global`## Conditional routes-A small set of routes depends on the deployment. A self-hosted deployment serves some of them only while its operator runs a premium tier or sells it, never serves the rest, and answers an unserved one with 404 `NOT_FOUND`. [Deployment availability](/http-api/deployment-availability/) lists every such route and states how a client reads which ones a deployment serves before authenticating.+A small set of routes depends on the deployment. A self-hosted deployment serves them only while its operator runs a premium tier or sells it, and answers an unserved one with 404 `NOT_FOUND`. [Deployment availability](/http-api/deployment-availability/) lists every such route and states how a client reads which ones a deployment serves before authenticating.## Cross-origin requests@@ -185,10 +183,6 @@ The paths below are readable from any origin. `/v1/webhooks/{webhook_id}/{token}`Access-Control-Expose-Headers` is the value `X-Fluxer-Version, ETag`. Every other Fluxer response header, the rate limit headers and `X-Request-ID` included, is hidden from cross-origin script. `Access-Control-Allow-Headers` is `Content-Type, Authorization, X-Requested-With, Accept-Language, X-Request-ID, If-None-Match`, so a cross-origin client revalidates an [ETag](/http-api/experiments/#get-experiment-assignments) it was served.-:::caution[Same-host mutations require a matching origin]-A production deployment rejects a non-`GET` request whose `Host` is `web.fluxer.app` or `web.canary.fluxer.app` unless its `Origin` is exactly `https://` followed by that same host, returning 403 `INVALID_API_ORIGIN`. A request sent to the API host is unaffected.-:::-<a id="error-response"></a>## Error response object@@ -255,61 +249,3 @@ Each entry identifies one failed input field. A 400 response whose top-level cod]}```--Fluxer produces at most one entry for each distinct pair of `path` and `code`, so a field that fails several constraints with the same `code` appears once.--## Resource pages--| Page | Covers |-| --- | --- |-| [Errors](/http-api/errors/) | The error envelope, status fallback mapping, and the API and validation code registries |-| [Deployment availability](/http-api/deployment-availability/) | Routes that exist only on the hosted deployment |-| [Authentication operations](/http-api/authentication/) | Registration, login, MFA, WebAuthn, SSO, email verification, recovery, sessions, IP authorisation, desktop handoff |-| [Gateway](/http-api/gateway/) | Bot discovery of the main Gateway endpoint and session start budget |-| [Instance](/http-api/instance/) | Instance discovery, client geolocation, the limit key registry, the served OpenAPI document |-| [OAuth2](/http-api/oauth2/) | Authorisation, consent, token exchange, introspection, revocation, granted authorisations |-| [Applications](/http-api/applications/) | Application, bot account, client secret, and bot token management, plus public lookup |-| [Connections](/http-api/connections/) | External account connection initiation, verification, visibility, and deletion |-| [Users](/http-api/users/) | The user object and the shared user enumerations |-| [Current user](/http-api/users/current-user/) | Current account retrieval, profile mutation, lifecycle, policy acceptance, authorised IP state |-| [User settings](/http-api/users/settings/) | Account, notification, and privacy settings, guild folders, voice activity sharing |-| [User settings Protobuf](/http-api/users/settings-protobuf/) | Every structured client preference message and enumeration |-| [Email and password changes](/http-api/users/email-and-password/) | The ticketed credential replacement flows |-| [Multi-factor authentication](/http-api/users/mfa/) | TOTP, backup codes, WebAuthn credentials, sudo verification |-| [Relationships](/http-api/users/relationships/) | Friend requests, friendships, blocks, relationship nicknames |-| [User notes](/http-api/users/notes/) | Private notes attached to user IDs |-| [Private channels](/http-api/users/private-channels/) | Direct message and group DM discovery, creation, preload, pin state |-| [User content collections](/http-api/users/content/) | Recent mentions, saved messages, asynchronous message deletion |-| [Gift inventory](/http-api/users/gifts/) | Premium gift codes created by the current account |-| [Data harvests](/http-api/users/data-harvest/) | Data harvest creation, status, and download |-| [Read states](/http-api/read-states/) | Message watermark and mention count acknowledgements |-| [Memes](/http-api/memes/) | The saved image, video, and audio collection and batch GIF URL resolution |-| [Themes](/http-api/themes/) | Shareable custom CSS theme creation |-| [Channels](/http-api/channels/) | Channel objects, private recipients, permission overwrites, slowmode, RTC regions |-| [Threads](/http-api/threads/) | Thread objects, starting and archiving threads, archived thread lists, thread search, thread permissions |-| [Thread members](/http-api/thread-members/) | Joining and leaving threads, member lists, thread notification settings |-| [Forums](/http-api/forums/) | Forum and media channels, forum tags, post data, webhooks that post into a forum |-| [Calls](/http-api/calls/) | Call eligibility, region selection, ringing, and termination |-| [Streams](/http-api/streams/) | Go Live stream keys, stream regions, preview image lifecycle |-| [Entrance sounds](/http-api/entrance-sounds/) | The entrance sound collection, its per-scope selections, and playback |-| [Messages](/http-api/messages/) | Messages, attachments, embeds, history, acknowledgements, pins, reactions, typing |-| [Guilds](/http-api/guilds/) | Guild objects and lifecycle operations |-| [Guild channels](/http-api/guild-channels/) | Listing, creation, hierarchy, permission inheritance, bulk positioning |-| [Guild members](/http-api/guild-members/) | Member objects, profiles, voice moderation, ownership, removal, role assignment |-| [Guild member search](/http-api/guild-member-search/) | Indexed search filters, sorting, pagination, supplemental join metadata |-| [Guild moderation](/http-api/guild-moderation/) | Bans, temporary bans, ban replacement, and the blocks a ban has |-| [Guild emojis](/http-api/guild-emojis/) | Guild emoji objects, uploads, metadata changes, deletion |-| [Guild stickers](/http-api/guild-stickers/) | Guild sticker objects, uploads, metadata changes, deletion |-| [Expressions](/http-api/expressions/) | Emoji and sticker metadata reads across both |-| [Guild audit logs](/http-api/guild-audit-logs/) | Audit entries, typed targets, contexts, changes, filters, the audit reason contract |-| [Roles and permissions](/http-api/permissions/) | Permission flags, computation order, role objects and lifecycle |-| [Discovery](/http-api/discovery/) | Public guild listings, categories, the listing application lifecycle, joining without an invite |-| [Invites](/http-api/invites/) | Invite lookup, creation, acceptance, deletion, code generation |-| [Webhooks](/http-api/webhooks/) | Webhook management, message execution, GitHub, Slack, Instatus, and Libredesk callbacks |-| [Search](/http-api/search/) | Authenticated global message search |-| [Unfurl](/http-api/unfurl/) | Authenticated external URL metadata resolution |-| [Billing](/http-api/billing/) | Stripe checkout, gift purchase, age verification, refunds, the Stripe webhook |-| [Premium](/http-api/premium/) | Premium pricing, entitlement state, subscription self-service, billing portal handoff |-| [Gifts](/http-api/gifts/) | Public gift code lookup and authenticated redemption |-| [Donations](/http-api/donations/) | Donation currencies and intervals, checkout sessions, the donor management link |-| [Reports](/http-api/reports/) | Authenticated safety reports and email-verified Digital Services Act notices |diff --git a/fluxer_docs/src/content/docs/http-api/premium.mdx b/fluxer_docs/src/content/docs/http-api/premium.mdxindex 9666c534b..301a3e8b1 100644--- a/fluxer_docs/src/content/docs/http-api/premium.mdx+++ b/fluxer_docs/src/content/docs/http-api/premium.mdx@@ -6,9 +6,9 @@ description: Premium pricing, entitlement state, billing data, and subscriptionimport RouteHeader from '@/components/RouteHeader.astro';-Premium is the paid tier of a Fluxer account. A recurring subscription, a redeemed gift, or a lifetime Visionary purchase pays for it. The routes here read that entitlement and run the subscription self-service operations, while [Billing](/http-api/billing/) owns purchase creation, refunds and the payment provider webhook.+Premium is the paid tier of a Fluxer account. A recurring subscription, a redeemed gift, or a lifetime entitlement pays for it. The routes here read that entitlement and run the subscription self-service operations, while [Billing](/http-api/billing/) owns purchase creation and the payment provider webhook.-Every route except [get price IDs](#get-price-ids) is user-only. A [self-hosted deployment](/http-api/deployment-availability/) always serves [get premium state](#get-premium-state) and [set premium perks disabled](#set-premium-perks-disabled). It never serves [switch subscription to the list price](#switch-subscription-to-the-list-price) or [rejoin Visionary guild](#rejoin-visionary-guild), serves [get price IDs](#get-price-ids) only while billing is active, and serves the subscription management routes while Stripe is serviceable.+Every route except [get price IDs](#get-price-ids) is user-only. A [self-hosted deployment](/http-api/deployment-availability/) always serves [get premium state](#get-premium-state) and [set premium perks disabled](#set-premium-perks-disabled), serves [get price IDs](#get-price-ids) only while billing is active, and serves the subscription management routes while Stripe is serviceable.| Object | Purpose || --- | --- |@@ -23,7 +23,6 @@ Every route except [get price IDs](#get-price-ids) is user-only. A [self-hosted| [Billing invoice](#billing-invoice-object) | One mirrored invoice || [Billing payment method](#billing-payment-method-object) | One mirrored payment method || [Premium pricing state](#premium-pricing-state-object) | The resolved checkout catalogue |-| [Store subscription](#store-subscription-object) | The active [in-app purchase](/http-api/in-app-purchases/) subscription |:::note[Manage billing through the customer portal][Get premium state](#get-premium-state) returns invoices, payment methods and subscription details. Use [Create customer portal](#create-customer-portal) to open the billing interface.@@ -35,7 +34,7 @@ Every route except [get price IDs](#get-price-ids) is user-only. A [self-hosted| --- | --- | --- || 0 | NONE | No premium entitlement || 1 | SUBSCRIPTION | Recurring or gift-funded premium entitlement |-| 2 | LIFETIME | Lifetime Visionary entitlement, which has a sequence number and community access |+| 2 | LIFETIME | Lifetime entitlement |## Billing cycles@@ -50,20 +49,7 @@ Every amount field is in the minor unit of the currency field its description naISK has no minor unit in ISO 4217, but its amounts still use two decimals, so divide them by 100. ISK 590 is `59000`.-A hosted deployment uses the currencies below. A self-hosted deployment whose operator sets its own prices uses the three-letter ISO 4217 codes the operator configured.--| Value | Description |-| --- | --- |-| USD | United States dollar |-| EUR | Euro |-| BRL | Brazilian real |-| DKK | Danish krone |-| INR | Indian rupee |-| ISK | Icelandic krona |-| NOK | Norwegian krone |-| PLN | Polish zloty |-| SEK | Swedish krona |-| TRY | Turkish lira |+Currency codes are the three-letter ISO 4217 codes the operator configured.## Price IDs object@@ -111,8 +97,6 @@ The checkout prices resolved for one country: monthly and yearly recurring, andThe price the account is billed against, and the current list price for the same billing cycle and currency.-The complete value is null when the account's subscription, billing cycle, or amount is unavailable.-### Structure| Field | Type | Description |@@ -156,7 +140,7 @@ A billing cycle change scheduled for the end of the current period. It is return| Field | Type | Description || --- | --- | --- || schedule_id | string | The payment provider subscription schedule ID that has the change |-| change_kind<sup>4</sup> | string | The kind of scheduled change, always `billing_cycle` here |+| change_kind | string | The kind of scheduled change, always `billing_cycle` here || current_billing_cycle<sup>1</sup> | ?string | The current [billing cycle](#billing-cycles) || target_billing_cycle | string | [Billing cycle](#billing-cycles) that takes effect at `effective_at` || effective_at | ISO8601 timestamp | The start of the scheduled future phase |@@ -174,8 +158,6 @@ A billing cycle change scheduled for the end of the current period. It is return<sup>3</sup> Null unless the scheduled adjustment is a credit. A monthly to yearly change credits the smaller of the two amounts, each multiplied by the subscription item quantity, and no credit is scheduled during a trial-<sup>4</sup> A scheduled move to the list price within the same billing cycle is not returned here. The [list price switch](#list-price-switch-object) reports it as `pending`-The complete value is null in each of these cases.| Condition | Detail |@@ -209,28 +191,22 @@ The complete value is null in each of these cases.## List price switch object-Whether the subscription can move to the current list price with [switch subscription to the list price](#switch-subscription-to-the-list-price). It is returned in [Premium billing state](#premium-billing-state-object).+Returned in [Premium billing state](#premium-billing-state-object). A self-hosted deployment offers no switch to the list price, so `available` and `pending` are false and `reason` is `feature_unavailable`.### Structure| Field | Type | Description || --- | --- | --- |-| available | boolean | Whether the switch can be requested now |-| reason<sup>1</sup> | ?string | The [refusal reason](#refusal-reasons) the switch would get, or null |-| pending<sup>2</sup> | boolean | Whether a switch to the current list price is already scheduled |+| available | boolean | Always false |+| reason | ?string | Always `feature_unavailable` |+| pending | boolean | Always false || current_price_id | ?string | The price ID the subscription bills on today || current_amount_minor | ?integer | The amount billed today, in the minor unit of `currency` || list_price_id | ?string | The current list price ID for the same billing cycle and currency || list_amount_minor | ?integer | The current list price amount, in the minor unit of `currency` || currency | ?string | [Display currency](#display-currencies) of both amounts |-| billing_cycle | ?string | The [billing cycle](#billing-cycles) the switch applies to |-| effective_at<sup>3</sup> | ?ISO8601 timestamp | When a switch takes effect |--<sup>1</sup> Null when `available` is true, and null when `pending` is true. `switch_in_progress` and `cancellation_managed_by_schedule` are only returned by the switch operation itself--<sup>2</sup> True when the scheduled change targets the current list price. Any other scheduled change gives `conflicting_pending_change`--<sup>3</sup> The end of the current billing period, or the start of the scheduled change when the subscription has one+| billing_cycle | ?string | The [billing cycle](#billing-cycles) of the subscription |+| effective_at | ?ISO8601 timestamp | The end of the current billing period |## Premium state object@@ -246,12 +222,10 @@ A client gates a premium feature on `effective.is_premium`.| effective | [effective premium state](#effective-premium-state-object) object | The entitlement every premium feature check reads || billing | [premium billing state](#premium-billing-state-object) object | The mirrored payment provider data for the account || pricing | [premium pricing state](#premium-pricing-state-object) object | The resolved checkout prices for the requested country |-| store<sup>1</sup> | ?[store subscription](#store-subscription-object) object | The active App Store or Google Play subscription, or null |-| subscription_provider<sup>2</sup> | ?string | The billing platform that owns the current recurring subscription, one of `stripe`, `app_store` or `google_play`, or null |--<sup>1</sup> Always null on a self-hosted deployment. When the account has more than one active store subscription, this is the one whose access ends last+| store | null | Always null |+| subscription_provider<sup>1</sup> | ?string | `stripe` when Stripe owns the current recurring subscription, or null |-<sup>2</sup> Null for a gift, a lifetime Visionary entitlement, or no subscription. `stripe` needs a Stripe subscription with a billing cycle and a paid period that has not ended. An account can hold an active Stripe subscription and an active store subscription at once, and then this names the one paid through later. A self-hosted deployment reports only `stripe` or null. A client sends a `stripe` subscriber to [create customer portal](#create-customer-portal) and a store subscriber to `store.manage_url`+<sup>1</sup> Null for a gift, a lifetime entitlement, or no subscription. `stripe` needs a Stripe subscription with a billing cycle and a paid period that has not ended. A client sends a `stripe` subscriber to [create customer portal](#create-customer-portal)### Example@@ -280,8 +254,9 @@ A client gates a premium feature on `effective.is_premium`."premium_grace_ends_at": null,"premium_enabled_override": false,"premium_purchase_disabled": false,+ "payment_dispute_open": false,"premium_perks_disabled": false,- "self_hosted": false,+ "self_hosted": true,"bot": false},"billing": {@@ -290,7 +265,7 @@ A client gates a premium feature on `effective.is_premium`."pending_subscription_change": null,"list_price_switch": {"available": false,- "reason": "no_active_subscription",+ "reason": "feature_unavailable","pending": false,"current_price_id": null,"current_amount_minor": null,@@ -306,14 +281,15 @@ A client gates a premium feature on `effective.is_premium`."payment_methods": [],"refund_eligibility": {"eligible": false,- "reason": "no_refundable_purchase",+ "reason": "feature_unavailable","invoice_id": null,"invoice_amount_paid_cents": null,"currency": null,"paid_at": null,"refund_window_expires_at": null,"cooldown_expires_at": null,- "cancels_subscription": false+ "cancels_subscription": false,+ "provider": null}},"pricing": {@@ -331,19 +307,8 @@ A client gates a premium feature on `effective.is_premium`."gift_currency": "USD"}},- "store": {- "provider": "app_store",- "purchase_id": "1501203318237184000",- "slot": "monthly",- "billing_cycle": "monthly",- "state": "active",- "expires_at": "2026-10-19T09:00:00.000Z",- "grace_ends_at": null,- "will_renew": true,- "manage_url": "https://apps.apple.com/account/subscriptions",- "environment": "production"- },- "subscription_provider": "app_store"+ "store": null,+ "subscription_provider": null}```@@ -360,19 +325,17 @@ The entitlement the account holds from billing alone. Nothing here reacts to the| premium_until<sup>2</sup> | ?ISO8601 timestamp | The time premium access ends, or null for a lifetime entitlement || premium_will_cancel | boolean | Whether the subscription is set to cancel at the end of the current period || premium_billing_cycle | ?string | [Billing cycle](#billing-cycles), or null when no recurring cycle is known |-| premium_lifetime_sequence<sup>3</sup> | ?integer | The Visionary sequence number, or null without lifetime entitlement |-| premium_grace_ends_at | ?ISO8601 timestamp | The end of grace access after a failed renewal, a subscription end or a store grace period, or null if none is recorded |-| has_active_paid_premium<sup>4</sup> | boolean | Whether paid premium access is active before local disabling |-| is_visionary | boolean | Whether the entitlement is lifetime Visionary access |+| premium_lifetime_sequence | ?integer | Always null, because a self-hosted instance allocates no lifetime sequence number |+| premium_grace_ends_at | ?ISO8601 timestamp | The end of grace access after a failed renewal, or a subscription end, or null if none is recorded |+| has_active_paid_premium<sup>3</sup> | boolean | Whether paid premium access is active before local disabling |+| is_visionary | boolean | Whether the entitlement is lifetime access || has_ever_purchased | boolean | Whether the account has ever completed a premium purchase |<sup>1</sup> An account that holds no stored premium type reports `0`<sup>2</sup> The later of the subscription period end and any stacked gift extension, so redeeming a gift on an active subscription moves this value-<sup>3</sup> Allocated once when lifetime entitlement is first granted, and retained afterwards--<sup>4</sup> Still true throughout the post-expiry grace window, which runs to `premium_grace_ends_at` when one is recorded and otherwise to exactly 3 days after `premium_until`+<sup>3</sup> Still true throughout the post-expiry grace window, which runs to `premium_grace_ends_at` when one is recorded and otherwise to exactly 3 days after `premium_until`### Example@@ -405,10 +368,11 @@ The effective state decides whether premium features are available. It differs f| premium_until<sup>3</sup> | ?ISO8601 timestamp | The time premium access ends, including any stacked gift extension, or null for a lifetime entitlement || premium_will_cancel<sup>3</sup> | boolean | Whether the subscription is set to cancel at the end of the current period || premium_billing_cycle<sup>3</sup> | ?string | [Billing cycle](#billing-cycles) |-| premium_lifetime_sequence<sup>3</sup> | ?integer | The Visionary sequence number, or null without lifetime entitlement |-| premium_grace_ends_at<sup>3</sup> | ?ISO8601 timestamp | The end of grace access after a failed renewal, a subscription end or a store grace period, or null if none is recorded |+| premium_lifetime_sequence<sup>3</sup> | ?integer | Always null, because a self-hosted instance allocates no lifetime sequence number |+| premium_grace_ends_at<sup>3</sup> | ?ISO8601 timestamp | The end of grace access after a failed renewal, or a subscription end, or null if none is recorded || premium_enabled_override<sup>4</sup> | boolean | Whether an operator premium override applies to the account || premium_purchase_disabled<sup>4</sup> | boolean | Whether purchases are disabled for the account |+| payment_dispute_open | boolean | Whether a payment dispute the account made is open. Every checkout is refused until it closes || premium_perks_disabled<sup>4</sup> | boolean | Whether the account has the perks-disabled flag || self_hosted<sup>5</sup> | boolean | Whether the deployment is self-hosted || bot<sup>6</sup> | boolean | Whether the credential is a bot account with premium-equivalent service access |@@ -443,7 +407,7 @@ Billing details can lag behind changes made through the payment provider.| invoices<sup>1</sup> | array[[billing invoice](#billing-invoice-object)] | The most recent invoices, newest first || invoices_has_more<sup>2</sup> | boolean | Whether the account has invoices beyond the returned page || payment_methods<sup>3</sup> | array[[billing payment method](#billing-payment-method-object)] | The stored payment methods |-| refund_eligibility<sup>4</sup> | [refund eligibility](/http-api/billing/#refund-eligibility-object) object | The self-service refund state for the account |+| refund_eligibility | [refund eligibility](/http-api/billing/#refund-eligibility-object) object | The self-service refund state, which always reports `feature_unavailable` |<sup>1</sup> At most 12 distinct invoices across the account's billing history, newest first@@ -451,8 +415,6 @@ Billing details can lag behind changes made through the payment provider.<sup>3</sup> The default payment method sorts first, then the rest by provider creation time descending-<sup>4</sup> Computed from the mirrored invoices, and it skips an invoice that already has a pending, succeeded or action-required refund. It can therefore differ from [get refund eligibility](/http-api/billing/#get-refund-eligibility)-Fluxer selects the subscription by preferring an `active` or `trialing` mirror, then a `past_due`, `unpaid` or `incomplete` one, then anything else. Ties break on the latest current period end.## Billing subscription object@@ -475,26 +437,6 @@ One mirrored payment provider subscription. Fluxer passes every member through,| plan_currency | ?string | The provider currency of the primary price, as the provider spells it || default_payment_method_id | ?string | The payment method the subscription bills |-<sup>1</sup> The provider interval, `month` or `year`, which differs from the [billing cycle](#billing-cycles) values used elsewhere on this page--### Example--```json-{- "id": "sub_1QaBcDeFgHiJkLmN",- "status": "active",- "current_period_start": "2026-08-14T09:00:00.000Z",- "current_period_end": "2026-09-14T09:00:00.000Z",- "cancel_at_period_end": false,- "cancel_at": null,- "canceled_at": null,- "plan_interval": "month",- "plan_amount_minor": 499,- "plan_currency": "usd",- "default_payment_method_id": "pm_1QaBcDeFgHiJkLmN"-}-```-## Billing invoice objectOne mirrored payment provider invoice. `hosted_invoice_url` and `invoice_pdf` are the only links to the invoice document.@@ -588,48 +530,6 @@ The checkout catalogue resolved for the request. A client can render prices withFluxer reports an unresolvable catalogue as null here, and the request still succeeds. [Get price IDs](#get-price-ids) answers 400 `STRIPE_ERROR` for the same condition.-## Store subscription object--The App Store or Google Play subscription that grants the account premium. The [store purchase](/http-api/in-app-purchases/#store-purchase-object) it comes from is listed by [list in-app purchases](/http-api/in-app-purchases/#list-in-app-purchases).--While no Stripe subscription is active, a store subscription leaves `actual.premium_billing_cycle` null. A client reads the cycle here and sends the subscriber to `manage_url`, since [create customer portal](#create-customer-portal) cannot manage a store subscription.--### Structure--| Field | Type | Description |-| --- | --- | --- |-| provider | string | Either `app_store` or `google_play` |-| purchase_id | snowflake | The ID of the store purchase |-| slot | string | Either `monthly` or `yearly` |-| billing_cycle | string | [Billing cycle](#billing-cycles) |-| state<sup>1</sup> | string | [Store purchase state](/http-api/in-app-purchases/#store-purchase-states) |-| expires_at | ISO8601 timestamp | End of the paid period |-| grace_ends_at | ?ISO8601 timestamp | End of the store grace period, or null outside grace |-| will_renew | boolean | Whether the subscription renews |-| manage_url<sup>2</sup> | string | Store page where the subscriber manages or cancels it |-| environment | string | Either `production` or `sandbox` |--<sup>1</sup> One of `active`, `grace` or `canceled`--<sup>2</sup> The App Store subscriptions page, or the Google Play subscriptions page for the product and package--### Example--```json-{- "provider": "google_play",- "purchase_id": "1501203318237184000",- "slot": "yearly",- "billing_cycle": "yearly",- "state": "active",- "expires_at": "2027-09-29T09:00:00.000Z",- "grace_ends_at": null,- "will_renew": true,- "manage_url": "https://play.google.com/store/account/subscriptions?sku=plutonium&package=com.fluxer",- "environment": "production"-}-```-## Get price IDs<RouteHeader method="GET" path="/v1/premium/price-ids" unauthenticated />@@ -666,11 +566,11 @@ Returns the [premium state](#premium-state-object) object for the authenticatedThe route is available even when no payment provider is configured.:::note[One read serves the whole billing screen]-`billing.current_subscription_price` and `billing.refund_eligibility` are the same objects returned by [get current subscription price](#get-current-subscription-price) and [get refund eligibility](/http-api/billing/#get-refund-eligibility), and `billing.pending_subscription_change` has no route of its own.+`billing.current_subscription_price` is the same object returned by [get current subscription price](#get-current-subscription-price), and `billing.pending_subscription_change` has no route of its own.::::::note[Billing details may take time to update]-`current_subscription_price` and `refund_eligibility` can temporarily differ from the dedicated routes after a billing change.+`current_subscription_price` can temporarily differ from [get current subscription price](#get-current-subscription-price) after a billing change.:::### Query parameters@@ -686,7 +586,6 @@ The route is available even when no payment provider is configured.| Status | Body | Condition || --- | --- | --- || 200 | [premium state](#premium-state-object) object | The state was returned |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |### Side effects@@ -856,6 +755,7 @@ A deployment that configures no payment provider receives 400 `STRIPE_PAYMENT_NO| --- | --- | --- || 204 | empty | The subscription was reactivated || 400<sup>1</sup> | [error response](/http-api/#error-response) | The subscription cannot be reactivated |+| 403 | [error response](/http-api/#error-response) | `PREMIUM_PURCHASE_BLOCKED` with the reason `payment_dispute_open`, because a payment dispute the account made is open || 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |<sup>1</sup> The account has no stored subscription, the subscription is not set to cancel, the payment provider is not configured, or the payment provider rejected the request@@ -899,6 +799,7 @@ A monthly to yearly change credits the first invoice of the new phase with the s| --- | --- | --- || 204 | empty | The change was applied, scheduled, or already in effect || 400<sup>1</sup> | [error response](/http-api/#error-response) | The billing cycle cannot be changed |+| 403 | [error response](/http-api/#error-response) | `PREMIUM_PURCHASE_BLOCKED` with the reason `payment_dispute_open`, because a payment dispute the account made is open || 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |<sup>1</sup> The account has no stored subscription, the subscription has no usable recurring item or future period end, no price is configured for the target cycle and currency, the payment provider is not configured, or the payment provider rejected the request@@ -913,71 +814,6 @@ A scheduled change becomes visible as `billing.pending_subscription_change` in [5 requests per minute for each authenticated user, on the `stripe:subscription:change` bucket.-## Switch subscription to the list price--<RouteHeader method="POST" path="/v1/premium/switch-to-list-price" />--Moves a subscription that still bills on a retired price onto the current list price for the same currency and [billing cycle](#billing-cycles), taking effect at the end of the current period. The request takes no body: the target price is resolved on the server, so a client cannot name the price it moves to.--The switch only ever lowers the amount charged. When the current list price is the same as, or higher than, the price the subscription bills on, the request is refused rather than applied.--Nothing is charged when the switch is scheduled. The billing date does not move, the billing cycle does not change, and no proration is invoiced or credited.--A deployment that configures no payment provider receives 400 `STRIPE_PAYMENT_NOT_AVAILABLE`, an account with no stored subscription receives 400 `STRIPE_NO_ACTIVE_SUBSCRIPTION`, and a provider failure receives 400 `STRIPE_ERROR`.--:::note[A subscription that is already cancelling is refused]-A subscription set to cancel has no next billing period, so the switch would have nothing to apply to. It is refused with `subscription_cancelling` and the pending cancellation is left untouched.-:::--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 200 | [switch result](#switch-result) | The switch was scheduled, was already scheduled, or was refused |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The payment provider is not configured, the account has no stored subscription, or the provider rejected the request |-| 404 | [error response](/http-api/#error-response) | The authenticated account record no longer exists and the request returns `UNKNOWN_USER` |--<sup>1</sup> A missing payment provider returns `STRIPE_PAYMENT_NOT_AVAILABLE` and a missing stored subscription returns `STRIPE_NO_ACTIVE_SUBSCRIPTION`, so this route never returns the `feature_unavailable` or `no_active_subscription` reason. Every other refusal is a 200 with `status` `ineligible`--### Switch result--| Field | Type | Description |-| --- | --- | --- |-| status | string | `scheduled`, `already_scheduled`, or `ineligible` |-| effective_at<sup>1</sup> | ISO8601 timestamp | The end of the current period, when the switch takes effect |-| target_price_id<sup>1</sup> | string | The price ID the subscription bills on after the switch |-| target_amount_minor<sup>1</sup> | integer | The amount billed after the switch, in the minor unit of `currency` |-| current_amount_minor<sup>1</sup> | integer | The amount billed before the switch, in the minor unit of `currency` |-| currency<sup>1</sup> | string | [Display currency](#display-currencies) of both amounts |-| reason<sup>2</sup> | string | Why the switch was refused |--<sup>1</sup> Present when `status` is `scheduled` or `already_scheduled`--<sup>2</sup> Present when `status` is `ineligible`--### Refusal reasons--- `feature_unavailable`: the deployment configures no payment provider-- `no_active_subscription`: the account has no stored subscription-- `subscription_not_chargeable`: the subscription is neither active nor on a trial-- `unsupported_subscription`: the subscription has no recurring primary item with a resolvable amount, currency and interval-- `no_list_price`: no list price is configured for that currency and billing cycle-- `already_on_list_price`: the subscription already bills on the current list price-- `not_a_price_decrease`: the current list price is not lower than the price the subscription bills on-- `subscription_cancelling`: the subscription is set to cancel, so it has no next billing period-- `cancellation_managed_by_schedule`: the subscription schedule ends by cancelling the subscription-- `conflicting_pending_change`: a different change is already scheduled-- `missing_period_end`: the subscription has no future period end-- `switch_in_progress`: another switch for the same account is still being applied--### Side effects--A scheduled switch becomes visible in [get premium state](#get-premium-state) as `billing.list_price_switch` with `pending` true. `billing.pending_subscription_change` stays null, because it reports billing cycle changes only. Every account session receives [User Update](/gateway/events/#user-update). A pending cancellation is never cleared by this route.--### Rate limit--5 requests per minute for each authenticated user, on the `stripe:subscription:change` bucket.-## Cancel pending subscription change<RouteHeader method="POST" path="/v1/premium/cancel-pending-subscription-change" />@@ -1003,40 +839,3 @@ Fluxer releases the subscription schedule, which removes the scheduled cycle cha### Rate limit5 requests per minute for each authenticated user, on the `stripe:subscription:change` bucket, shared with [change subscription billing cycle](#change-subscription-billing-cycle).--## Rejoin Visionary guild--<RouteHeader method="POST" path="/v1/premium/visionary/rejoin" />--Adds the authenticated account back to the configured Visionary community guild and returns 204 with an empty body.--The route requires a lifetime entitlement, so an account whose premium type is not lifetime receives 403 `MISSING_ACCESS`.--A join emits [Guild Create](/gateway/events/#guild-create), [Guild Member Add](/gateway/events/#guild-member-add) and, when the guild has a system channel and does not suppress join notifications, [Message Create](/gateway/events/#message-create). The role grant that follows emits [Guild Member Update](/gateway/events/#guild-member-update). An account that already belongs to the guild produces that Dispatch alone.--The operation is idempotent. For an account that already belongs to the guild, Fluxer grants the Visionary role again and changes nothing else. The join bypasses the guild ban check, so a banned account is added anyway.--Both size ceilings still apply. An account already at its maximum number of guilds receives 400 `MAX_GUILDS`, and a Visionary guild at its member ceiling receives 400 `MAX_GUILD_MEMBERS`. Neither check runs for an account that already belongs to the guild.--A deployment that configures no Visionary guild or no Visionary role returns 400 `STRIPE_ERROR`, and a configured Visionary guild that does not exist returns 404 `UNKNOWN_GUILD`. A role grant that fails is logged and absorbed, so the response is still 204 and the account keeps its membership without the role.--### Response--| Status | Body | Condition |-| --- | --- | --- |-| 204 | empty | The account joined the guild or already belonged to it |-| 400<sup>1</sup> | [error response](/http-api/#error-response) | The deployment is not configured, or a size ceiling is reached |-| 403 | [error response](/http-api/#error-response) | The account holds no lifetime entitlement and the request returns `MISSING_ACCESS` |-| 404 | [error response](/http-api/#error-response) | The configured Visionary guild does not exist and the request returns `UNKNOWN_GUILD` |--<sup>1</sup> The deployment configures no Visionary guild or no Visionary role and returns `STRIPE_ERROR`, the account is at its guild ceiling and the request returns `MAX_GUILDS`, or the guild is at its member ceiling and the request returns `MAX_GUILD_MEMBERS`--### Side effects--A new membership sends [Guild Create](/gateway/events/#guild-create) with complete guild state to the joining account and [Guild Member Add](/gateway/events/#guild-member-add) to the guild. It also creates a join system message and sends [Message Create](/gateway/events/#message-create) unless the guild has no system channel or suppresses join notifications.--A new or existing member then receives the Visionary role, which records a `MEMBER_ROLE_UPDATE` guild audit log entry attributed to the system user and emits [Guild Member Update](/gateway/events/#guild-member-update). An account already holding the role causes no role change and records no audit entry. Billing state is unchanged.--### Rate limit--5 requests per minute for each authenticated user, on the `stripe:visionary:rejoin` bucket.diff --git a/fluxer_docs/src/content/docs/http-api/users/gifts.mdx b/fluxer_docs/src/content/docs/http-api/users/gifts.mdxindex 14548c53c..710e48927 100644--- a/fluxer_docs/src/content/docs/http-api/users/gifts.mdx+++ b/fluxer_docs/src/content/docs/http-api/users/gifts.mdx@@ -82,7 +82,7 @@ The listing is not paginated, so it accepts no query parameter and returns no cuAn unredeemed code is listed indefinitely. A redeemed code is listed only while its redemption is less than seven days old, so an account whose codes were all redeemed longer ago receives an empty array.-A revoked code is omitted at every age. Fluxer revokes a code when a dispute or refund reaches the purchase while the code is still unredeemed, and no route reports the reversal to the buyer. A code already redeemed when the reversal arrived is not revoked, so it stays listed under the seven-day rule while Fluxer recomputes the redeemer's entitlement from their remaining redeemed gifts.+A revoked code is omitted at every age. Fluxer revokes a code when a refund, or a dispute that closes as `lost`, reaches the purchase while the code is still unredeemed, and no route reports the reversal to the buyer. A code already redeemed when the reversal arrived is not revoked, so it stays listed under the seven-day rule while Fluxer recomputes the redeemer's entitlement from their remaining redeemed gifts.A redeemed code that has dropped out of the listing still exists, still resolves through the [Gifts resource](/http-api/gifts/), and is still permanently spent. A revoked code stops resolving through that resource with 404 `UNKNOWN_GIFT_CODE`.