Version 0.1.0+20261122T201000Z · November 22, 2026 · Reviewer: Scott
Readiness: implementation foundation; the paid journey is not operational or verified end to end. This plan covers one standalone course in a controlled pilot. It preserves native ChatGPT sign-in, the existing email/SMS verification design, public preparation resources, and the hold on newsletter thirty-four and marketing expansion. It does not enable providers, send messages, create charges or grant course access.
What the inspection establishes
The production runtime inspection found revision 3 with only ASSET_DELIVERY_WRITE_MODE=disabled. Stripe credentials, Twilio credentials, their enable flags and the verification pilot allowlist are absent. D1 exposes fourteen application tables; table names establish deployed schema, not enrollment contents or successful transactions. No personal rows were read for this plan.
The focused local suite passes 340 checks across nine member, verification, authorization and payment test files. SQLite migrations execute, but provider transports use intercepted fixtures. Those results support domain behavior; they do not establish actual delivery, native sign-in continuity, provider configuration or hosted two-account isolation. Twenty-four production HTTP checks passed across the custom and platform origins: anonymous member APIs and forged identity headers were denied, identity-dependent responses were no-store, and the disabled test receiver rejected an unsigned event. The native sign-in entry was observed reaching OpenAI login; no signed-in lifecycle was completed. Scott confirmed that neither Stripe sandbox nor Twilio Verify is configured. These findings are recorded separately and do not prove the paid journey.
| Boundary | Existing implementation | Remaining acceptance |
|---|---|---|
| Account identity | app/chatgpt-auth.ts; native sign-in and protected API identity | Hosted sign-in, reload, sign-out and two-account observation |
| Verification | member-step-up.mjs; managed email/SMS adapter, bound destinations, quotas, short proof and client UI | Real delivery, recovery, retention and fresh-login binding |
| Checkout | Immutable test orders, consent references, retry-safe session helper | Reviewed document registry and authenticated HTTP/UI integration |
| Payment | Signed test inbox, fresh Stripe reconciliation, separate test access/hold ledger | Live-capable fulfillment, approved purchase clock and atomic grant |
| Enrollment | Read-only summaries; pure purchase and authorization policies | Persisted authorized transitions and production route integration |
| Media | Public review/download delivery | Private course media, authorized playback and operational verification |
handleEnrollmentRequest explicitly returns playbackAvailable:false. The test receiver returns fulfillment:false; verified test receipts remain verified_no_grant. Existing helpers must not be presented as an operational paywall.
Target journey and scope
Native Site identity → email/SMS proof → approved order and terms acceptance → Stripe-hosted Checkout → durable verified payment event → atomic course grant → server entitlement checks → private media delivery → expiry, revocation and support.
Native identity remains the base account boundary. It does not itself satisfy the designed email/SMS proof. Keep platform sign-in as a top-level navigation; do not build a second OAuth stack. Anonymous browsing remains available. The learner sees the course, amount, currency, access period, purchase-start rule, download policy, terms and support route before accepting an order.
The initial release is a one-time, one-course purchase. Subscriptions, teams, seats, automatic renewals and grace periods are outside this pilot. The proposed $495 and 90 days remain unapproved commercial proposals. Neither tests nor this plan approve them.
Phase 0 — freeze the pilot contract
Scott selects the pilot course, reviewed recording and captions, two consenting pilot accounts, and the applicable commercial documents. Record the approved price, currency, duration, purchase-time definition, refund/dispute policy, downloads, support and recovery procedure in versioned records. A real learner's consent must reference immutable document bytes, not a mutable URL alone.
Separate public teasers and review materials from future paid payloads. Current /review PPTX/PDF downloads are public, and release artifacts are in public GitHub. A future login page cannot protect those existing copies or recall downloads. Put paid originals and recordings outside public directories, source repositories, public R2 delivery catalogs, archives and downloadable backups. Decide explicitly which existing materials remain public.
Exit: approved pilot configuration and data-handling procedures; private asset list; no ambiguous offer presented for payment.
Phase 1 — prove identity and close the session gap
Exercise native sign-in, save/reload/delete of a fictional generic plan, sign-out, and independent account B. Ownership must come from platform identity, never a body, query, payment metadata or user-supplied header. Verify the platform strips forged identity headers, private responses cannot cross caches, and mutations enforce same-origin requests.
Configure a dedicated Twilio Verify service, email delivery configuration, intended SMS destinations/geographies, provider fraud controls, spending alerts and pilot allowlist. Store credentials and a high-entropy binding secret through hosted secret settings. Enable verification only after the provider and participant checks; sending still needs the user's explicit acknowledgment. Test wrong/expired codes, quotas, interrupted delivery, resumed flows, cancellation and approved recovery. Do not log codes or raw session secrets.
P0 session gap: readMemberStepUp currently binds proof to user ID, flow cookie and destination hashes, not an exposed native login-session ID. Existing sign-out links do not explicitly revoke that proof. Same-account re-login inside its lifetime may reuse it. The requirement for fresh verification on a new login is therefore not demonstrated.
Implement a server-owned training-session record with finite lifetime, proof binding, revocation and accountable events. The application's sign-out must revoke training proof/session and clear its cookie before platform sign-out. Confirm whether the platform supplies a supported native-session binding or lifecycle signal. Direct platform logout and re-login must be tested too. If the required lifecycle cannot be observed reliably, resolve that capability or explicitly review the requirement before paid release; a short TTL alone does not prove new-login freshness. Do not invent a platform callback or infer a login from a page visit.
Exit: two real accounts pass isolation, factor binding and sign-out/re-login tests; fresh-login semantics are explicit and satisfied.
Phase 2 — connect authenticated sandbox checkout
Add same-origin, bounded JSON checkout and consent routes, for example app/api/training/checkout/route.ts, plus a purchase page and owned order-status endpoint. These are proposed routes, not existing capabilities. Reuse purchase-order-ledger.mjs, purchase-checkout-intents.mjs and stripe-test-checkout.mjs where their test-only boundaries fit. Keep server offers authoritative: the browser selects a course, not its price, duration or owner.
Persist order and affirmative terms acceptance before provider session creation. Preserve the existing durable idempotency key and fixed session parameters across ambiguous retries. Return only the validated Stripe-hosted URL after session binding succeeds. A cancelled or abandoned checkout produces no entitlement. Returning to the success page is a status check, never proof of payment. Offer a clear pending state if processing is incomplete.
Use a dedicated sandbox, matched account and test prices first. Keep sandbox and eventual live credentials, signing secrets, event receipts and grants distinguishable. Never promote a test_purchase_access row into a live enrollment merely by enabling a flag.
Exit: the exact owned order survives browser interruption and retry, without duplicate sessions or grants; no live charge is possible.
Phase 3 — implement durable fulfillment and enrollment
Retain bounded raw-body signature verification, expected account checks and fresh provider reads from stripe-test-inbox.mjs and stripe-test-reconciliation.mjs. Add a deliberate production-capable fulfillment path rather than silently changing test receipts to grant access. Validate the saved learner/order/session/price/amount/currency/course relationship before granting.
The current test policy uses the original payment_intent.succeeded event creation time. That is event evidence, not an approved exact capture/settlement timestamp. Select and document the authoritative successful-purchase field/event for the supported payment method and configuration. Persist its provenance; derive starts_at and expires_at once. Delivery, first viewing and re-login cannot restart the duration. Deferred payment support needs its own successful-payment handling or must remain outside the pilot.
Use additive migrations, preserving applied SQL history. Proposed records include a versioned commercial-document registry, a durable fulfillment event state/attempt record, a purchase-to-course grant keyed uniquely by provider/account/purchase/course, enrollment transition events, training sessions and a private course-asset registry. Existing training_enrollments has only order uniqueness and status/start/expiry; reconcile that schema with the richer purchase-domain model before connecting it. Specify foreign keys or equivalent validated references and indexes for owner/course, event identity, expiry and revocation lookups.
A D1 transaction/batch must make grant uniqueness and its durable processing result consistent. A separately committed inbox is acceptable only when retries or a durable worker resume unfinished work. Never acknowledge an event as fulfilled between payment verification and a lost grant write. Handle duplicate, concurrent, out-of-order, delayed and interrupted processing. Store only required identifiers and audit facts, with sanitized errors and recovery visibility.
Exit: a successful sandbox purchase creates exactly one correct enrollment; denial/hold states survive later success retries; purchase dates never move.
Phase 4 — deliver private learning
Add a server-only playback authorization route and private media handler, for example app/api/training/[courseId]/playback/route.ts and app/api/training/media/[assetId]/route.ts. Resolve asset keys from a trusted course registry. Read native identity, the current training session/proof, course enrollment, expiry and holds for each authorization; never accept these facts from browser JSON.
Reuse authorizePlayback after building records from trusted reads, with explicit adapters for its state fields versus database status fields. A signed short-lived token should bind learner, course, asset/version, session and expiry. Bound its expiry by proof, session and entitlement limits. The media handler must enforce identity/session binding and current revocation as well as token signature; a copied URL must not authorize another learner.
Store the reviewed MP4 in private Sites R2 with no public object URL. Test HEAD, valid ranges, seeking, invalid/unsatisfiable ranges, disconnects and renewal, including revocation or expiry between requests. Use private/no-store responses and avoid shared caching of authenticated content. Test captions/transcripts/downloads under the same visibility policy. Do not promise DRM or recall of already buffered/downloaded bytes. Measure startup, mobile playback, file size and delivery cost before choosing whether a streaming provider is necessary.
Exit: account A can watch only its valid course; B, anonymous, unverified, unpaid, expired and revoked cases cannot obtain protected bytes.
Phase 5 — close refund, recovery and operations
The existing test ledger conservatively holds access for partial/full refunds and disputes, including closed/won disputes. Approve the actual customer policy separately. Implement verified provider events as monotonic denial states; a paid retry must not reactivate them. Any reinstatement, extension or manual grant requires an authorized human, reason, original record linkage and an audit event. A manual grant is not a fabricated payment.
Provide owner-authorized revoke/extend/recovery workflows, least-privilege administration, retained support records and a staffed route. Factor changes must verify identity through the approved recovery procedure rather than accepting a new phone. Define retention/deletion for pseudonymous verification, payment and audit records, and provider retention separately. Test key rotation, session invalidation, provider outage and database failure without exposing secrets.
Back up the schema and approved configuration references, rehearse additive migrations in a separate test environment, then deploy with new checkout/media/grant flags off. Rollback disables new entry and access issuance, preserves receipts and enrollment history, and reconciles any paid-but-unfulfilled order with human support. It must not delete payment history or reset access clocks. Assess the impact before applying a destructive schema rollback.
Acceptance, rollout and ownership
The accompanying matrix is the execution contract. Each row needs an environment, observed result and sanitized evidence; a fixture pass cannot close a hosted/provider row. Scott reviews commercial, participant and release decisions. Engineering owns integration and evidence; operations owns support, reconciliation and recovery.
Run in order: local contract tests → isolated sandbox integration → two-account hosted pilot → reviewed private media pilot → refund/expiry/outage rehearsal → limited release. Release requires zero unresolved access-control failures, actual provider delivery, correct immutable grants, two-account/two-course denial tests, private media protection, approved terms, recovery/support, monitoring and rollback. Keep subscriptions and live sales disabled until their own gates pass. The next concrete implementation step is Phase 1's two-account identity/session pilot, alongside Scott's Phase 0 selections.
Provider setup runbook
Scott confirmed that neither provider is configured. Start in isolated test services, with live sales disabled. Account creation, sender/domain verification, participant consent and spending limits are prerequisites; this release performs none of those external actions.
- Create a dedicated Stripe sandbox and test product/price for the approved pilot offer. Record its expected account ID. Use the current adapter-compatible snapshot event format and verify its API/event compatibility in the sandbox before registering the destination; do not adopt a preview or thin-event format merely because it is the newest example.
- Register the existing test destination
/api/payments/stripe/test-eventsonly for the approved sandbox event set. Configure the sandbox key and its own destination signing secret. A disabled receiver currently returns 503; schedule activation deliberately so provider retries and test outcomes are understood. - Create Twilio Verify and its email integration. Email delivery also needs the SendGrid configuration, authenticated sender domain and code template described in the official guide. Confirm SMS country permissions, intended destinations, fraud controls and owner-approved spending/abuse limits. Do not send codes until each pilot participant explicitly requests delivery.
- Identify two separate native Site accounts through actual hosted sign-in. Use the Site-specific IDs for the allowlist; do not substitute email addresses, names or guessed IDs. Keep these participant identifiers out of the public review artifacts.
- Configure the following names through hosted runtime secrets/settings, never source or chat. Keep enable flags off until their dependency checks pass. Do not expose any key value in screenshots or reports.
| Purpose | Existing runtime names | Activation condition |
|---|---|---|
| Stripe sandbox | STRIPE_TEST_SECRET_KEY, STRIPE_TEST_ACCOUNT_ID, STRIPE_TEST_WEBHOOK_SECRET | Correct sandbox, price, destination and compatible events verified |
| Stripe pilot gates | STRIPE_TEST_RECEIVER_ENABLED, STRIPE_TEST_PROCESSOR_ENABLED, STRIPE_TEST_ACCESS_POLICY | Enable in the controlled sandbox sequence; test policy is not a live grant |
| Managed verification | TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_VERIFY_SERVICE_SID, MEMBER_BINDING_SECRET | Email/SMS delivery setup, secret handling and binding design reviewed |
| Verification gate | MEMBER_VERIFICATION_ENABLED, MEMBER_VERIFICATION_PILOT_IDS | Two consenting accounts, explicit delivery and session-lifecycle acceptance ready |
Redeploy after a deliberate runtime change, record the resulting configuration revision without secret values, and execute the applicable matrix rows. Keep ASSET_DELIVERY_WRITE_MODE=disabled; public marketing-download maintenance is unrelated to protected training delivery. Enable no live payment capability until the separate fulfillment, private-media and release gates pass.
Sources and evidence boundaries
Repository references are relative to thrivepci/source: app/chatgpt-auth.ts, app/api/member/*, app/api/payments/stripe/test-events/route.ts, src/server/member-service.mjs, member-step-up.mjs, training-access.mjs, purchase-enrollment.mjs, the purchase/Stripe modules listed above, and additive migrations drizzle/0000 through 0007. Existing specifications: TRAINING_ACCESS_SPEC.md, docs/MEMBER_AREA.md, docs/STRIPE_LOGIN_PILOT_v0.2.0.md. Runtime inspection and current test results are supplied by the release audit; real provider/browser evidence remains separately recorded.
Stripe fulfillment (opens in a new tab) supports server-side, retry-safe fulfillment and handling of delayed successful payments. Stripe webhooks (opens in a new tab) informs signature verification and durable processing. Twilio email verification (opens in a new tab) and rate limits (opens in a new tab) inform service setup and delivery limits. The proposed architecture, phases and acceptance conditions are thrivePCI implementation decisions, not provider certifications or a PCI compliance conclusion.