client error fix

This commit is contained in:
Sewmina 2025-06-25 01:34:47 +05:30
parent 94883bd04d
commit fec2c8c789
3 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@
import { useState } from 'react';
import { useAuth } from '../context/AuthContext';
import { getStripe } from '../lib/stripe';
import { getStripe } from '../lib/stripe-client';
interface PaymentModalProps {
isOpen: boolean;

7
app/lib/stripe-client.ts Normal file
View File

@ -0,0 +1,7 @@
import { loadStripe } from '@stripe/stripe-js';
// Initialize Stripe on the client
export const getStripe = () => {
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!);
return stripePromise;
};

View File

@ -1,12 +1,5 @@
import { loadStripe } from '@stripe/stripe-js';
import { headers } from 'next/headers';
// Initialize Stripe on the client
export const getStripe = () => {
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!);
return stripePromise;
};
// Helper function to create a payment intent (server-side only)
export async function createPaymentIntent(amount: number, currency: string = 'usd') {
try {