Open AI UGC — free, open-source alternative to Arcads and MakeUGC. Generate AI UGC video ads with realistic AI actors using Veo 3.1, Seedance 2, Grok Video, and Happy Horse 1. Self-host on Next.js + Stripe + MUAPI.
JavaScript ai-actorsai-marketingai-ugcai-video-adsai-video-generatorarcads-alternativeimage-to-videomakeugc-alternativemuapinextjsopen-sourcesaas-templateseedanceseedance2text-to-videotiktok-adsugc-adsugc-videouser-generated-contentveo-3
import { NextResponse } from "next/server";
import { getServerSession } from "next-auth/next";
import { authOptions } from "@/lib/auth";
import Stripe from "stripe";
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
export async function POST(req) {
try {
const session = await getServerSession(authOptions);
if (!session?.user) {
return new NextResponse("Unauthorized", { status: 401 });
}
const { plan } = await req.json();
if (!plan) {
return new NextResponse("Plan required", { status: 400 });
}
// Create Stripe Checkout Session
const checkoutSession = await stripe.checkout.sessions.create({
payment_method_types: ["card"],
line_items: [
{
price_data: {
currency: "usd",
product_data: {
name: plan.name,
description: plan.description,
},
unit_amount: Math.round(parseFloat(plan.price.replace("$", "")) * 100) || 0,
},
quantity: 1,
},
],
mode: "payment",
success_url: `${process.env.NEXTAUTH_URL}/gallery?status=success`,
cancel_url: `${process.env.NEXTAUTH_URL}/pricing?status=cancelled`,
metadata: {
userId: session.user.id,
planName: plan.name,
credits: plan.credits.toString(),
},
});
return NextResponse.json({ url: checkoutSession.url });
} catch (error) {
console.error("[STRIPE_CHECKOUT_ERROR]", error);
return new NextResponse("Internal Error", { status: 500 });
}
}