From b2aa31f4ba57d6fb3d371108755ddc539cb257d3 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 2 Nov 2024 22:28:13 +0100 Subject: [PATCH] Bugfix/handle missing Stripe api key exception (#4013) * Conditionally initialize Stripe --- .../src/app/subscription/subscription.service.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/api/src/app/subscription/subscription.service.ts b/apps/api/src/app/subscription/subscription.service.ts index ef73f346c..ae0260d8c 100644 --- a/apps/api/src/app/subscription/subscription.service.ts +++ b/apps/api/src/app/subscription/subscription.service.ts @@ -28,12 +28,14 @@ export class SubscriptionService { private readonly prismaService: PrismaService, private readonly propertyService: PropertyService ) { - this.stripe = new Stripe( - this.configurationService.get('STRIPE_SECRET_KEY'), - { - apiVersion: '2024-09-30.acacia' - } - ); + if (this.configurationService.get('ENABLE_FEATURE_SUBSCRIPTION')) { + this.stripe = new Stripe( + this.configurationService.get('STRIPE_SECRET_KEY'), + { + apiVersion: '2024-09-30.acacia' + } + ); + } } public async createCheckoutSession({