a
This commit is contained in:
21
app/api/checkout/route.ts
Normal file
21
app/api/checkout/route.ts
Normal 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();
|
||||
};
|
||||
Reference in New Issue
Block a user