"use client";
import { useSession } from "next-auth/react";
import { useState } from "react";
import Navbar from "@/components/Navbar";
import Footer from "@/components/Footer";
import { FaCheck, FaInfoCircle } from "react-icons/fa";
import axios from "axios";
import toast, { Toaster } from "react-hot-toast";
const PLANS = [
{ id: "basic", name: "Basic Pack", price: "$5", credits: 100, description: "Perfect for testing custom prompts and exploring styles." },
{ id: "standard", name: "Standard Pack", price: "$10", credits: 250, description: "Ideal for regular creators wanting high resolution outputs." },
{ id: "pro", name: "Professional Pack", price: "$20", credits: 600, description: "Designed for power users demanding batch exports and high speed.", popular: true },
{ id: "business", name: "Business Pack", price: "$50", credits: 2000, description: "Maximum value pack for agency workflows and large volume generations." }
];
export default function Pricing() {
const { data: session, status } = useSession();
const [loadingPlan, setLoadingPlan] = useState(null);
const handleCheckout = async (planId) => {
if (status !== "authenticated") {
toast.error("You must sign in with Google to purchase credit packages.");
return;
}
setLoadingPlan(planId);
try {
const { data } = await axios.post("/api/checkout", { planId });
if (data.url) {
window.location.href = data.url;
} else {
throw new Error("No redirection URL returned");
}
} catch (err) {
console.error(err);
toast.error(err.response?.data?.error || "Failed to trigger Stripe checkout session.");
} finally {
setLoadingPlan(null);
}
};
return (
Pricing Plans
Buy Credits Packs
Purchase flexible credit packages to perform high-resolution predictions. Keep all profits — we handle AI infrastructure.
{/* Pricing Cards Grid */}
{PLANS.map((plan) => (
{plan.popular && (
Most Popular
)}
{plan.credits} Art Credits
{plan.description}
-
Dynamic aspect ratios
-
HD image downloads
-
No subscription required
))}
);
}