From c5fc3a7e8e47201548aa4e61727213e627e39ef6 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Thu, 22 Sep 2022 21:03:59 +0530 Subject: [PATCH] Add Billing link (#4668) --- packages/app-store/stripepayment/api/portal.ts | 2 +- packages/ui/v2/core/layouts/SettingsLayout.tsx | 4 ++-- packages/ui/v2/core/navigation/tabs/VerticalTabItem.tsx | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/app-store/stripepayment/api/portal.ts b/packages/app-store/stripepayment/api/portal.ts index 7087c5304f..f04d3b4be8 100644 --- a/packages/app-store/stripepayment/api/portal.ts +++ b/packages/app-store/stripepayment/api/portal.ts @@ -4,7 +4,7 @@ import { getStripeCustomerIdFromUserId } from "../lib/customer"; import stripe from "../lib/server"; export default async function handler(req: NextApiRequest, res: NextApiResponse) { - if (req.method === "POST") { + if (req.method === "POST" || req.method === "GET") { const customerId = await getStripeCustomerIdFromUserId(req.session!.user.id); if (!customerId) { diff --git a/packages/ui/v2/core/layouts/SettingsLayout.tsx b/packages/ui/v2/core/layouts/SettingsLayout.tsx index 01b01cd5b0..5a2eac445a 100644 --- a/packages/ui/v2/core/layouts/SettingsLayout.tsx +++ b/packages/ui/v2/core/layouts/SettingsLayout.tsx @@ -48,8 +48,7 @@ const tabs: VerticalTabItemProps[] = [ href: "/settings/billing", icon: Icon.FiCreditCard, children: [ - // - { name: "invoices", href: "/settings/billing" }, + { name: "Manage Billing", href: "/api/integrations/stripepayment/portal", isExternalLink: true }, ], }, { @@ -143,6 +142,7 @@ const SettingsSidebarContainer = ({ className = "" }) => { , "href">; }; @@ -43,6 +44,7 @@ const VerticalTabItem = function ({ <> )}
- {t(name)} + + {t(name)} + {props.isExternalLink ? : null} + {info && ( {t(info)}