From dba69e18b7bc11006a86593d1d5c1d50d23fba93 Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Wed, 18 Nov 2020 14:36:23 +0530 Subject: [PATCH] :recycle: Redirect to session home --- src/modules/stripe/stripe.service.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/modules/stripe/stripe.service.ts b/src/modules/stripe/stripe.service.ts index a768b25d2..f05cd5976 100644 --- a/src/modules/stripe/stripe.service.ts +++ b/src/modules/stripe/stripe.service.ts @@ -81,7 +81,12 @@ export class StripeService { groupId: number, ): Promise> { const stripeId = await this.stripeId(groupId); - return this.stripe.billingPortal.sessions.create({ customer: stripeId }); + return this.stripe.billingPortal.sessions.create({ + customer: stripeId, + return_url: `${this.configService.get( + 'frontendUrl', + )}/groups/${groupId}`, + }); } async getInvoices( @@ -183,14 +188,10 @@ export class StripeService { >('payments.paymentMethodTypes') ?? ['card'], success_url: `${this.configService.get( 'frontendUrl', - )}/groups/${groupId}/billing/${ - mode === 'setup' ? 'sources' : 'subscription' - }`, + )}/groups/${groupId}`, cancel_url: `${this.configService.get( 'frontendUrl', - )}/groups/${groupId}/billing/${ - mode === 'setup' ? 'sources' : 'subscription' - }`, + )}/groups/${groupId}`, }; if (mode === 'subscription') data.line_items = [{ quantity: 1, price: planId }];