Skip to content

refactor(stripe): use lookup keys instead of hardcoded price IDs - #28

Merged
Simplereally merged 1 commit into
mainfrom
refactor/stripe-lookup-keys
Jan 24, 2026
Merged

Simplereally merged 1 commit into
mainfrom
refactor/stripe-lookup-keys

Conversation

@Simplereally

@Simplereally Simplereally commented Jan 24, 2026

Copy link
Copy Markdown
Owner
  • Replace NEXT_PUBLIC_STRIPE_PRO_*_PRICE_ID env vars with Stripe lookup keys
  • Add convex/lib/stripeHelpers.ts with price resolution logic
  • Add 27 unit tests for stripe helpers
  • Fix TypeScript strict mode violations (any -> unknown)
  • Delete obsolete lib/config/stripe.ts

Stripe Dashboard is now the single source of truth for pricing. Set lookup_key: pro_monthly on the price in Stripe Dashboard.

Summary by CodeRabbit

  • Tests

    • Added comprehensive test suite for Stripe payment utilities, covering price lookup, plan resolution, and error handling scenarios.
  • Refactor

    • Improved payment checkout infrastructure with enhanced error handling and runtime price resolution for better reliability.

✏️ Tip: You can customize this high-level summary in your review settings.

- Replace NEXT_PUBLIC_STRIPE_PRO_*_PRICE_ID env vars with Stripe lookup keys
- Add convex/lib/stripeHelpers.ts with price resolution logic
- Add 27 unit tests for stripe helpers
- Fix TypeScript strict mode violations (any -> unknown)
- Delete obsolete lib/config/stripe.ts

Stripe Dashboard is now the single source of truth for pricing.
Set lookup_key: pro_monthly on the price in Stripe Dashboard.
@vercel

vercel Bot commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Review Updated (UTC)
bloomstudio Building Building Preview, Comment Jan 24, 2026 9:34am

@Simplereally
Simplereally marked this pull request as ready for review January 24, 2026 09:34
@coderabbitai

coderabbitai Bot commented Jan 24, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This refactoring shifts Stripe price management from static environment-based configuration to runtime lookup-key resolution. The system now uses planType to dynamically resolve prices via new Stripe helpers, eliminating pre-check validation and simplifying the checkout flow.

Changes

Cohort / File(s) Summary
Stripe Pricing Infrastructure
convex/lib/stripeHelpers.ts, convex/lib/stripeHelpers.test.ts
New helper module introducing PlanType, PRICE_LOOKUP_KEYS constants, and utility functions (getLookupKeyForPlan, fetchPriceByLookupKey, resolvePriceForPlan, createStripeClient, getStripeErrorMessage). Comprehensive test suite validates all success/failure branches and error handling.
Price Resolution Migration
convex/stripe.ts, app/pricing/checkout-button.tsx
Updated checkout flow to resolve prices at runtime using planType instead of pre-configured priceId. Removed client-side Stripe configuration validation. Replaced direct Stripe client instantiation with createStripeClient factory and centralized error handling.
Configuration Removal
lib/config/stripe.ts
Deleted static STRIPE_CONFIG constant and isStripeConfigured() function that relied on environment-based price IDs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A hop and a skip through pricing we go,
From static configs to lookups that flow,
Runtime resolving with planType in hand,
Helper functions sturdy, well-tested and grand,
Stripe's lookup keys guide us through the night! 🌙


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@Simplereally
Simplereally merged commit 868cfe3 into main Jan 24, 2026
1 of 4 checks passed
@Simplereally
Simplereally deleted the refactor/stripe-lookup-keys branch January 24, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant