'init'
This commit is contained in:
15
app/api/pay/status/route.ts
Normal file
15
app/api/pay/status/route.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { getOrderStatus } from "@/lib/sdk";
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const orderId = request.nextUrl.searchParams.get("order_id");
|
||||
if (!orderId) {
|
||||
return NextResponse.json({ ok: false, error: "缺少 order_id" }, { status: 400 });
|
||||
}
|
||||
try {
|
||||
const { paid } = await getOrderStatus(orderId);
|
||||
return NextResponse.json({ ok: true, paid });
|
||||
} catch (e) {
|
||||
return NextResponse.json({ ok: false, paid: false, error: String(e) }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user