fix: tidy stripe feature and add provider

This commit is contained in:
Mythie
2023-05-06 14:33:27 +10:00
parent 900b816ae0
commit da0166b746
9 changed files with 170 additions and 23 deletions

View File

@ -1,5 +1,6 @@
import { NextApiRequest, NextApiResponse } from "next";
import { stripe } from "../index";
import { stripe } from "../client";
export type PortalSessionRequest = {
body: {
@ -43,11 +44,11 @@ export const portalSessionHandler = async (req: NextApiRequest, res: NextApiResp
const session = await stripe.billingPortal.sessions.create({
customer: id,
return_url: `${process.env.NEXT_PUBLIC_BASE_URL}/settings/billing`,
return_url: `${process.env.NEXT_PUBLIC_WEBAPP_URL}/settings/billing`,
});
return res.status(200).json({
success: true,
url: session.url,
});
};
};