From 45eb9762b7c7fd542359bf91b8f92cf7c708b749 Mon Sep 17 00:00:00 2001 From: Iaroslav Gryshaiev Date: Tue, 3 Dec 2024 22:03:15 +0000 Subject: [PATCH] fix(billing): filter prices by product (#511) --- apps/api/src/billing/services/stripe/stripe.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/billing/services/stripe/stripe.service.ts b/apps/api/src/billing/services/stripe/stripe.service.ts index 2f7558d03..60a97a96e 100644 --- a/apps/api/src/billing/services/stripe/stripe.service.ts +++ b/apps/api/src/billing/services/stripe/stripe.service.ts @@ -44,7 +44,7 @@ export class StripeService extends Stripe { } private async getPrice(amount?: string) { - const { data: prices } = await this.prices.list({ product: this.billingConfig.get("STRIPE_PRODUCT_ID") }); + const { data: prices } = await this.prices.list({ active: true, product: this.billingConfig.get("STRIPE_PRODUCT_ID") }); const price = prices.find(price => { const isCustom = !amount && !!price.custom_unit_amount; @@ -62,7 +62,7 @@ export class StripeService extends Stripe { } async findPrices(): Promise { - const { data: prices } = await this.prices.list({ active: true }); + const { data: prices } = await this.prices.list({ active: true, product: this.billingConfig.get("STRIPE_PRODUCT_ID") }); const responsePrices = prices.map(price => ({ unitAmount: price.custom_unit_amount ? undefined : price.unit_amount / 100, isCustom: !!price.custom_unit_amount,