From 5a4a594e53ba3cb135bed10413c63b5b10c10713 Mon Sep 17 00:00:00 2001 From: Jorge Luis Calleja Alvarado Date: Wed, 18 Sep 2024 22:33:54 -0600 Subject: [PATCH] fix(core): Lint --- src/libs/payments/stripe/checkout/server.ts | 51 --------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/libs/payments/stripe/checkout/server.ts diff --git a/src/libs/payments/stripe/checkout/server.ts b/src/libs/payments/stripe/checkout/server.ts deleted file mode 100644 index ffc9389..0000000 --- a/src/libs/payments/stripe/checkout/server.ts +++ /dev/null @@ -1,51 +0,0 @@ -'use server'; - -import type Stripe from 'stripe'; - -import { stripe } from '@/libs/stripe/checkout/config'; - -import { getURL } from '@/utils/helpers'; - -// type Price = Stripe.Price; - -export async function checkoutWithStripe(redirectPath: string = '/') { - let params: Stripe.Checkout.SessionCreateParams = { - allow_promotion_codes: true, - billing_address_collection: 'required', - // payment_method_types: ['card'], - // customer_update: { - // address: 'auto', - // }, - line_items: [ - { - price_data: { - currency: 'mxn', - product_data: { - name: 'Pruebas', - }, - unit_amount: 8000, // En centavos (MXN 80.00) - }, - quantity: 1, - }, - ], - mode: 'payment', - cancel_url: getURL(), - success_url: getURL(redirectPath), - }; - - // Create a checkout session in Stripe - let session; - try { - session = await stripe.checkout.sessions.create(params); - } catch (err) { - console.error(err); - throw new Error('Unable to create checkout session.'); - } - - // Instead of returning a Response, just return the data or error. - if (session) { - return { sessionId: session.id }; - } else { - throw new Error('Unable to create checkout session.'); - } -}