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
This commit is contained in:
1 parent
0a9e732ea4
commit
712467a7f4
1 file changed
+5
@@ -107,6 +107,10 @@ export class BillingService implements OnModuleDestroy {
|
|||||||
const teamWithBilling = await this.teamsRepository.findByIdIncludeBilling(teamId);
|
const teamWithBilling = await this.teamsRepository.findByIdIncludeBilling(teamId);
|
||||||
const customerId = teamWithBilling?.platformBilling?.customerId;
|
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({
|
const { url } = await this.stripeService.getStripe().checkout.sessions.create({
|
||||||
customer: customerId,
|
customer: customerId,
|
||||||
success_url: `${this.webAppUrl}/settings/platform/`,
|
success_url: `${this.webAppUrl}/settings/platform/`,
|
||||||
@@ -116,6 +120,7 @@ export class BillingService implements OnModuleDestroy {
|
|||||||
teamId: teamId.toString(),
|
teamId: teamId.toString(),
|
||||||
plan: plan.toString(),
|
plan: plan.toString(),
|
||||||
},
|
},
|
||||||
|
currency: "usd",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!url) throw new InternalServerErrorException("Failed to create Stripe session.");
|
if (!url) throw new InternalServerErrorException("Failed to create Stripe session.");
|
||||||
|
|||||||
Reference in new issue
Block a user