From 712467a7f41faf0bd6bf92184ea4e397bbbe1c4e Mon Sep 17 00:00:00 2001 From: Rajiv Sahal Date: Mon, 1 Sep 2025 18:31:54 +0530 Subject: [PATCH] fix: bring back `currency` param for checkout creation when updating team subscription (#23488) * fix: make sure customer id is always defined and add logs * fix: bring back currency param for checkout creation when updating team subscription --- apps/api/v2/src/modules/billing/services/billing.service.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/api/v2/src/modules/billing/services/billing.service.ts b/apps/api/v2/src/modules/billing/services/billing.service.ts index 2cdefb3f77..477883ef14 100644 --- a/apps/api/v2/src/modules/billing/services/billing.service.ts +++ b/apps/api/v2/src/modules/billing/services/billing.service.ts @@ -107,6 +107,10 @@ export class BillingService implements OnModuleDestroy { const teamWithBilling = await this.teamsRepository.findByIdIncludeBilling(teamId); const customerId = teamWithBilling?.platformBilling?.customerId; + if (!customerId) { + throw new NotFoundException("No customer id associated with the team."); + } + const { url } = await this.stripeService.getStripe().checkout.sessions.create({ customer: customerId, success_url: `${this.webAppUrl}/settings/platform/`, @@ -116,6 +120,7 @@ export class BillingService implements OnModuleDestroy { teamId: teamId.toString(), plan: plan.toString(), }, + currency: "usd", }); if (!url) throw new InternalServerErrorException("Failed to create Stripe session.");