Files
myeasycms-v2/packages/billing/stripe/src/services/create-stripe-billing-portal-session.ts
gbuomprisco 23154c366d Remove Cloudflare mailer implementation, update dependencies and updated code to reflect stricter EsLint settings
Deleted CloudflareMailer class and its implementation from the mailers package. Updated dependencies across various packages, converting certain imports to use `type` only, and bumped versions for packages like `react-query`, `lucide-react`, and others.
2024-08-01 14:57:55 +02:00

19 lines
519 B
TypeScript

import type { Stripe } from 'stripe';
import { z } from 'zod';
import type { CreateBillingPortalSessionSchema } from '@kit/billing/schema';
/**
* @name createStripeBillingPortalSession
* @description Create a Stripe billing portal session for a user
*/
export async function createStripeBillingPortalSession(
stripe: Stripe,
params: z.infer<typeof CreateBillingPortalSessionSchema>,
) {
return stripe.billingPortal.sessions.create({
customer: params.customerId,
return_url: params.returnUrl,
});
}