The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
fix: stripe price fetch (#1677)
David Nguyen3dce814ab283
diff --git a/packages/ee/server-only/stripe/get-prices-by-plan.ts b/packages/ee/server-only/stripe/get-prices-by-plan.tsindex 45906d54a..52c9d1e5e 100644--- a/packages/ee/server-only/stripe/get-prices-by-plan.ts+++ b/packages/ee/server-only/stripe/get-prices-by-plan.ts@@ -4,15 +4,14 @@ import { stripe } from '@documenso/lib/server-only/stripe';type PlanType = (typeof STRIPE_PLAN_TYPE)[keyof typeof STRIPE_PLAN_TYPE];export const getPricesByPlan = async (plan: PlanType | PlanType[]) => {- const planTypes = typeof plan === 'string' ? [plan] : plan;+ const planTypes: string[] = typeof plan === 'string' ? [plan] : plan;- const query = planTypes.map((planType) => `metadata['plan']:'${planType}'`).join(' OR ');-- const { data: prices } = await stripe.prices.search({- query,+ const prices = await stripe.prices.list({expand: ['data.product'],limit: 100,});- return prices.filter((price) => price.type === 'recurring');+ return prices.data.filter(+ (price) => price.type === 'recurring' && planTypes.includes(price.metadata.plan),+ );};