This commit is contained in:
2026-02-04 01:05:00 +00:00
parent f9222627ef
commit d02d95e680
30 changed files with 2449 additions and 326 deletions

21
app/api/checkout/route.ts Normal file
View File

@@ -0,0 +1,21 @@
import { Checkout } from "@polar-sh/nextjs";
import { NextResponse } from "next/server";
export const GET = async () => {
if (!process.env.POLAR_ACCESS_TOKEN || !process.env.POLAR_SUCCESS_URL) {
return NextResponse.json(
{
error:
"Missing POLAR_ACCESS_TOKEN or POLAR_SUCCESS_URL environment variables.",
},
{ status: 400 }
);
}
const handler = Checkout({
accessToken: process.env.POLAR_ACCESS_TOKEN,
successUrl: process.env.POLAR_SUCCESS_URL,
});
return handler();
};