Skip to content

docs(env): STRIPE_* placeholders for Phase 2 PR 2 - #747

Closed
LucasSantana-Dev wants to merge 1 commit into
mainfrom
chore/stripe-env-placeholders
Closed

LucasSantana-Dev wants to merge 1 commit into
mainfrom
chore/stripe-env-placeholders

Conversation

@LucasSantana-Dev

Copy link
Copy Markdown
Owner

Summary

Drops the 5 env vars Phase 2 PR 2 will consume into `.env.example` now, commented out. Zero runtime change — the billing routes don't exist yet; when PR 2 lands they default to disabled via `STRIPE_ENABLED=false`.

Placeholders

Env var Purpose
`STRIPE_ENABLED` Master switch. 503s all billing routes when false.
`STRIPE_SECRET_KEY` Server-side Stripe API key (use sk_test_... for staging).
`STRIPE_PUBLISHABLE_KEY` Frontend Stripe.js mount, if we ever need Elements.
`STRIPE_PRICE_ID` Single $2.99/mo tier price ID.
`STRIPE_WEBHOOK_SECRET` `whsec_...` for signature verification. `stripe listen` prints this locally.

Why land this separately

  • Lets PR 2 start from a known env surface
  • Keeps PR 2's diff focused on the Stripe integration itself
  • Makes the env surface reviewable in isolation

Test plan

  • `.env.example` still parses (no uncommented blanks, valid shell)
  • Zero code touched

Drops the 5 env vars the billing PR will consume into .env.example now,
commented out. Zero runtime change — the billing routes don't exist yet;
when PR 2 lands they default to disabled via STRIPE_ENABLED=false.

Rationale for landing this separately:
- Lets the next session start PR 2 without touching .env.example
- Makes the env surface reviewable in isolation
- Keeps PR 2's diff focused on the actual Stripe integration

Placeholders documented:
- STRIPE_ENABLED — master switch, 503s when false
- STRIPE_SECRET_KEY — sk_test_... for staging
- STRIPE_PUBLISHABLE_KEY — frontend Stripe.js mount (if needed)
- STRIPE_PRICE_ID — single \$2.99/mo tier
- STRIPE_WEBHOOK_SECRET — whsec_... for signature verification
@vercel

vercel Bot commented Apr 20, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Apr 20, 2026 3:51am

Request Review

@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) April 20, 2026 03:50
@coderabbitai

coderabbitai Bot commented Apr 20, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@LucasSantana-Dev has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 2 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 50 minutes and 2 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a24d984f-c80b-442e-a07b-61f13e7603f5

📥 Commits

Reviewing files that changed from the base of the PR and between d21a422 and 67122c3.

📒 Files selected for processing (1)
  • .env.example
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/stripe-env-placeholders

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

LucasSantana-Dev added a commit that referenced this pull request Apr 20, 2026
Introduces the /api/billing/* and /webhooks/stripe route surface gated
behind STRIPE_ENABLED. Zero runtime change — STRIPE_ENABLED defaults to
unset so production hits the 503 path everywhere. Sets the shape for
the real billing PR without touching the stripe npm dep, Prisma, or the
frontend.

Adds:
- utils/billingConfig.ts — isStripeEnabled(), getStripeConfig(),
  requireStripeEnabled(). Tiny env-reading helpers, no caching. Pattern
  mirrors utils/developerAccess.ts.
- routes/billing.ts — four endpoints (status GET, checkout POST,
  portal POST, subscription DELETE). Each short-circuits via
  requireStripeEnabled() then throws AppError(501, 'Not implemented')
  so enabling the flag later produces predictable "to be implemented"
  responses.
- routes/stripeWebhook.ts — POST /webhooks/stripe. Top-of-file comment
  flags the express.json() body-parsing issue that will matter once
  real signature verification lands. Not solved here because the 503
  returns before body access.
- routes/index.ts — imports + adds both to routeSetups.

Wiring notes:
- /api/billing/* inherits apiLimiter via the existing '/api/' prefix
  middleware.
- Billing routes with mutations use writeLimiter.
- /webhooks/stripe is deliberately non-/api/ so it skips apiLimiter
  (Stripe retries on its own cadence; client-IP rate limiting is
  counterproductive).

Feature gating for this PR is literally the STRIPE_ENABLED flag and
nothing else. No requireAuth, no guildGuardConfigs entry — those are
future-PR concerns and the 503 returns before they'd apply.

Tests: 8 total across two files:
- 4 "disabled → 503" cases (one per endpoint).
- "STRIPE_ENABLED=false (explicit) → 503" proves case handling.
- "STRIPE_ENABLED=true → 501" spot-checks the flag is actually read.
- 2 matching cases for the webhook.

Follows up #747 (env placeholders) and #745/#746 (spec + PremiumService
stub). Next PR wires in the stripe npm dep, Prisma subscription reads
via PremiumService, and replaces the 501 placeholders with real logic.
@LucasSantana-Dev

Copy link
Copy Markdown
Owner Author

Paused: Stripe/premium-billing work deferred. The existing premiumService.isPremium(guildId) in @lucky/shared already acts as the feature toggle (returns false for every guild without a subscription row). Re-open or re-create when premium work resumes. Related: #746 (schema already on main, harmless no-op), #750 (premium autoplay — gate works as the feature flag).

auto-merge was automatically disabled April 21, 2026 02:02

Pull request was closed

@LucasSantana-Dev
LucasSantana-Dev deleted the chore/stripe-env-placeholders branch April 21, 2026 02:02
LucasSantana-Dev added a commit that referenced this pull request Apr 21, 2026
Promotes ~/.claude/plans/lucky-next-phases-ultraplan.md into a committed
spec under docs/specs/2026-04-20-lucky-next-phases/ via the spec-new
skill. Includes a rewritten tasks.md with Phase 0/1 marked shipped
(PRs #728-#743), Phase 2 status (PRs #746/#747/#749/#750 shipped, real
Stripe SDK + PR 4 dashboard remaining), and an audit inventory of
premium gates across packages/*/src to guide PR 4 wiring.

Key audit findings:
- Only PremiumService + replenisher.ts reference isPremium today
- Collaborative playlist service already exists — natural P2 gate
- embedColor palette is the cheapest premium UX gate
- Leaderboard row-limit is frontend-paginated, not backend-enforced
LucasSantana-Dev added a commit that referenced this pull request Apr 21, 2026
Per 2026-04-20 decision: removing Stripe features for now. The existing
premiumService.isPremium() check serves as the feature toggle (returns
false without subscription rows, so all premium-adjacent paths behave
as if off).

Closed PRs: #745 (spec), #747 (env), #749 (routes)
Kept: #746 (schema, harmless no-op on main), #750 (autoplay gate =
the live toggle)
LucasSantana-Dev added a commit that referenced this pull request Apr 22, 2026
* docs(spec): promote lucky-next-phases ultraplan to docs/specs

Promotes ~/.claude/plans/lucky-next-phases-ultraplan.md into a committed
spec under docs/specs/2026-04-20-lucky-next-phases/ via the spec-new
skill. Includes a rewritten tasks.md with Phase 0/1 marked shipped
(PRs #728-#743), Phase 2 status (PRs #746/#747/#749/#750 shipped, real
Stripe SDK + PR 4 dashboard remaining), and an audit inventory of
premium gates across packages/*/src to guide PR 4 wiring.

Key audit findings:
- Only PremiumService + replenisher.ts reference isPremium today
- Collaborative playlist service already exists — natural P2 gate
- embedColor palette is the cheapest premium UX gate
- Leaderboard row-limit is frontend-paginated, not backend-enforced

* docs(spec): mark Phase 2 (Stripe/premium billing) as deferred

Per 2026-04-20 decision: removing Stripe features for now. The existing
premiumService.isPremium() check serves as the feature toggle (returns
false without subscription rows, so all premium-adjacent paths behave
as if off).

Closed PRs: #745 (spec), #747 (env), #749 (routes)
Kept: #746 (schema, harmless no-op on main), #750 (autoplay gate =
the live toggle)
LucasSantana-Dev added a commit that referenced this pull request May 13, 2026
* docs(spec): promote lucky-next-phases ultraplan to docs/specs

Promotes ~/.claude/plans/lucky-next-phases-ultraplan.md into a committed
spec under docs/specs/2026-04-20-lucky-next-phases/ via the spec-new
skill. Includes a rewritten tasks.md with Phase 0/1 marked shipped
(PRs #728-#743), Phase 2 status (PRs #746/#747/#749/#750 shipped, real
Stripe SDK + PR 4 dashboard remaining), and an audit inventory of
premium gates across packages/*/src to guide PR 4 wiring.

Key audit findings:
- Only PremiumService + replenisher.ts reference isPremium today
- Collaborative playlist service already exists — natural P2 gate
- embedColor palette is the cheapest premium UX gate
- Leaderboard row-limit is frontend-paginated, not backend-enforced

* docs(spec): mark Phase 2 (Stripe/premium billing) as deferred

Per 2026-04-20 decision: removing Stripe features for now. The existing
premiumService.isPremium() check serves as the feature toggle (returns
false without subscription rows, so all premium-adjacent paths behave
as if off).

Closed PRs: #745 (spec), #747 (env), #749 (routes)
Kept: #746 (schema, harmless no-op on main), #750 (autoplay gate =
the live toggle)

This branch was successfully deployed

1 active deployment
Preview — 67122c3e Deployed Apr 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant