mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
20 lines
424 B
TypeScript
20 lines
424 B
TypeScript
'use server';
|
|
|
|
import { stripe } from '@documenso/lib/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;
|
|
};
|