Files
sign/packages/lib/ee/stripe/get-portal-session.ts
2023-08-30 16:15:13 +10:00

20 lines
415 B
TypeScript

'use server';
import { stripe } from '../../server-only/stripe';
export type GetPortalSessionOptions = {
customerId: string;
returnUrl: string;
};
export const getPortalSession = async ({ customerId, returnUrl }: GetPortalSessionOptions) => {
'use server';
const session = await stripe.billingPortal.sessions.create({
customer: customerId,
return_url: returnUrl,
});
return session.url;
};