Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions apps/app/src/actions/stripe/fetch-price-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export type CachedPrices = {
const CACHE_DURATION = 30 * 60; // 30 minutes in seconds

export async function fetchStripePriceDetails(): Promise<CachedPrices> {
const cacheKey = 'stripe:managed-prices';
// Fetch from Stripe
const monthlyPriceId = env.NEXT_PUBLIC_STRIPE_SUBSCRIPTION_MANAGED_MONTHLY_PRICE_ID;
const yearlyPriceId = env.NEXT_PUBLIC_STRIPE_SUBSCRIPTION_MANAGED_YEARLY_PRICE_ID;

// Create a unique cache key that includes the price IDs
const cacheKey = `stripe:managed-prices:${monthlyPriceId || 'none'}:${yearlyPriceId || 'none'}`;

try {
// Check cache first
Expand All @@ -34,10 +39,6 @@ export async function fetchStripePriceDetails(): Promise<CachedPrices> {
console.error('[STRIPE] Error reading from cache:', error);
}

// Fetch from Stripe
const monthlyPriceId = env.NEXT_PUBLIC_STRIPE_SUBSCRIPTION_MANAGED_MONTHLY_PRICE_ID;
const yearlyPriceId = env.NEXT_PUBLIC_STRIPE_SUBSCRIPTION_MANAGED_YEARLY_PRICE_ID;

let monthlyPrice: PriceDetails | null = null;
let yearlyPrice: PriceDetails | null = null;

Expand Down
Loading