Skip to content

Commit

Permalink
fix(billing): filter prices by product
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev authored Dec 3, 2024
1 parent 27fffd4 commit 45eb976
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/api/src/billing/services/stripe/stripe.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -62,7 +62,7 @@ export class StripeService extends Stripe {
}

async findPrices(): Promise<StripePrices[]> {
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,
Expand Down

0 comments on commit 45eb976

Please sign in to comment.