A browser flag saying an account is paid cannot authorise an expensive operation. Customers can modify browser state, and an old page can remain open after the underlying entitlement changes.
Paid-feature enforcement belongs where the server accepts the action or returns the protected result. The interface should explain access, while the backend decides whether this user, resource, and operation are currently allowed.
Define entitlement separately from login and billing display
A signed-in user may have no paid access. A customer with a past invoice may have a cancelled or refunded entitlement. Define the application's access record and how it is updated from authoritative billing information.
Decide whether access belongs to a user, organisation, individual study, or another resource. An account-level paid flag is too broad when the product sells one-time access to a specific item.
Test a fictional paid-study operation
Suppose a founder can create one free study and purchases access to an additional study. The server should check the actor's ownership and the relevant study entitlement before allowing the paid operation.
Test a valid purchase, an unpaid study, a paid study owned by another account, an expired access state, and a browser flag manually changed to paid. Attempt the operation through a direct request as well as the interface. Confirm rejected attempts do not create records or trigger expensive background work.
Open the paid screen, revoke the entitlement in the test environment, and submit from the old page. The response should follow the current policy rather than the page's remembered state. If the product intentionally provides a grace period, represent and test it explicitly.
Handle delayed billing updates without inventing access
External payment state and application entitlements can temporarily diverge. Define a pending state, a reconciliation path, and a support lookup. The official Stripe webhook guide documents its event integration; verify the actual provider's contract before designing your update path.
Do not make the browser's checkout return URL the only evidence of payment. It can help resume the user experience, but the server needs trusted confirmation appropriate to the integration.
The tradeoff is freshness versus availability. A live provider lookup for every action adds dependency and latency; a local entitlement record needs reliable updates and reconciliation. Choose a boundary, document its delay policy, and test refunds, cancellations, and missed events.
StackFlight's portfolio account describes paid study access in a shipped product. The acceptance cases here are proposed checks, not a security or billing audit of that implementation.
Questions about paid-feature checks
Is hiding the upgrade-only button enough?
No. Protect the server operation, generated output, and relevant background work. The button is a usability affordance.
Should a payment failure delete customer work?
Not automatically. Define creation, editing, reading, export, and retention rights separately so billing state does not cause unintended data loss.
What is the first useful test?
Modify the browser's paid state and attempt a direct protected request. Bring any mismatch between display and server outcome to a billing-access review.