Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Redirect to session home
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 18, 2020
1 parent 018837c commit dba69e1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/modules/stripe/stripe.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ export class StripeService {
groupId: number,
): Promise<Stripe.Response<Stripe.BillingPortal.Session>> {
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<string>(
'frontendUrl',
)}/groups/${groupId}`,
});
}

async getInvoices(
Expand Down Expand Up @@ -183,14 +188,10 @@ export class StripeService {
>('payments.paymentMethodTypes') ?? ['card'],
success_url: `${this.configService.get<string>(
'frontendUrl',
)}/groups/${groupId}/billing/${
mode === 'setup' ? 'sources' : 'subscription'
}`,
)}/groups/${groupId}`,
cancel_url: `${this.configService.get<string>(
'frontendUrl',
)}/groups/${groupId}/billing/${
mode === 'setup' ? 'sources' : 'subscription'
}`,
)}/groups/${groupId}`,
};
if (mode === 'subscription')
data.line_items = [{ quantity: 1, price: planId }];
Expand Down

0 comments on commit dba69e1

Please sign in to comment.