Repository navigation
Conversation
Add two endpoints so an organization can pay for premium: one creates a Stripe Checkout Session, the other reports status and period end. Nothing is stored. The session tags the subscription with the organization id, and status is read back from Stripe by that metadata. Stripe's search lags, so the status endpoint also accepts the session id from the return url, which is immediately consistent. Both endpoints require the organization role and check the caller's claim against the path id.
The SDK default is 80s and the home page waits on this call.
samwel141
force-pushed
the
feat-stripe-subscription-1261
branch
from
October 17, 2026 20:29
68bf6ce to
a1afbdc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of Greenstand/treetracker-admin-client#1261
Problem
An organization has no way to pay for premium.
Change
Nothing is stored. The session tags
subscription_data.metadata.organization_id, and status is read back from Stripe by that metadata.Stripe's search index lags up to a minute, so the GET also accepts the
session_idStripe appends to the return url and retrieves the session directly, which is immediately consistent.Both endpoints sit behind
requireRole(Role.ORGANIZATION)and compare the caller'sorganization_idclaim with the path id. The secret key never leaves the API.New env:
STRIPE_SECRET_KEY,STRIPE_PRICE_ID,STRIPE_RETURN_URL.Verification
13 new tests across the controller and the service. Full suite 92 passing,
tsc --noEmitclean, eslint clean.Exercised end to end against the Stripe sandbox with test card 4242: Checkout completed, the return read the session, and the renewal date appeared immediately.
Related
Greenstand/treetracker-admin-client#1267 adds the panel side and needs this deployed first.