Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2013038dca |
@@ -12,11 +12,8 @@ import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
|
||||
import ContactCenter from '@/components/sections/contact/ContactCenter';
|
||||
import FooterBaseSocial from '@/components/sections/footer/FooterBaseSocial';
|
||||
import { Flame, Users, CheckCircle, Heart, Sparkles, Mail, Instagram, Facebook, Youtube, Twitter } from "lucide-react";
|
||||
import { loadStripe } from '@stripe/stripe-js';
|
||||
import { useState } from 'react';
|
||||
|
||||
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || '');
|
||||
|
||||
export default function LandingPage() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -41,18 +38,11 @@ export default function LandingPage() {
|
||||
}
|
||||
|
||||
const { sessionId } = await response.json();
|
||||
const stripe = await stripePromise;
|
||||
|
||||
if (!stripe) {
|
||||
throw new Error('Stripe failed to load');
|
||||
}
|
||||
|
||||
const { error: redirectError } = await stripe.redirectToCheckout({
|
||||
sessionId,
|
||||
});
|
||||
|
||||
if (redirectError) {
|
||||
setError(redirectError.message || 'Payment failed');
|
||||
if (sessionId) {
|
||||
window.open(`https://checkout.stripe.com/pay/${sessionId}`, '_blank');
|
||||
} else {
|
||||
setError('Payment session creation failed');
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Payment error occurred');
|
||||
|
||||
Reference in New Issue
Block a user