diff --git a/src/app/page.tsx b/src/app/page.tsx index 03c8fb1..ac73dc3 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -14,17 +14,26 @@ import PricingCardThree from '@/components/sections/pricing/PricingCardThree'; import TestimonialCardTen from '@/components/sections/testimonial/TestimonialCardTen'; export default function LandingPage() { - const handlePayment = (price: string) => { + const processPayment = (price: string) => { const script = document.createElement("script"); script.src = "https://checkout.razorpay.com/v1/checkout.js"; script.onload = () => { const options = { - key: "YOUR_RAZORPAY_KEY", amount: parseInt(price.replace(/\D/g, "")) * 100 * 21, + key: "YOUR_RAZORPAY_KEY", amount: 2100, // 21 Rupees currency: "INR", name: "TechPlatform", description: "Purchase of 21 units", handler: async (response: any) => { - alert("Payment Successful! Ref: " + response.razorpay_payment_id); - await fetch("/api/submit-lead", { - method: "POST", body: JSON.stringify({ paymentId: response.razorpay_payment_id, units: 21 }), - }); + try { + await fetch("/api/submit-lead", { + method: "POST", headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + paymentId: response.razorpay_payment_id, + units: 21, + status: 'success' + }), + }); + alert("Payment Successful! Thank you for your order."); + } catch (e) { + console.error("Error submitting lead", e); + } }, theme: { color: "#3b82f6" }, }; @@ -106,12 +115,12 @@ export default function LandingPage() { textboxLayout="default" useInvertedBackground={false} plans={[ - { id: "basic", price: "$29", name: "Basic", buttons: [{ text: "Buy Basic", onClick: () => handlePayment("$29") }], features: ["1 User", "Basic Analytics", "Email Support"] }, - { id: "pro", price: "$99", name: "Professional", badge: "Popular", buttons: [{ text: "Buy Pro", onClick: () => handlePayment("$99") }], features: ["5 Users", "Advanced Analytics", "24/7 Support"] }, - { id: "enterprise", price: "$299", name: "Enterprise", buttons: [{ text: "Buy Enterprise", onClick: () => handlePayment("$299") }], features: ["Unlimited Users", "Full API Access", "Dedicated Manager"] }, + { id: "basic", price: "₹21", name: "Basic", buttons: [{ text: "Pay ₹21", onClick: () => processPayment("21") }], features: ["1 User", "Basic Analytics", "Email Support"] }, + { id: "pro", price: "₹21", name: "Pro", badge: "Popular", buttons: [{ text: "Pay ₹21", onClick: () => processPayment("21") }], features: ["5 Users", "Advanced Analytics", "24/7 Support"] }, + { id: "enterprise", price: "₹21", name: "Enterprise", buttons: [{ text: "Pay ₹21", onClick: () => processPayment("21") }], features: ["Unlimited Users", "Full API Access", "Dedicated Manager"] }, ]} title="Flexible Plans" - description="Choose the right plan for your team size. All purchases are for 21 units." + description="Get access to our platform for just 21 Rupees." />