2025-04-08 14:37:17 +07:00

33 lines
856 B
JavaScript

import { NextResponse } from "next/server";
export async function GET(request) {
const { searchParams } = new URL(request.url);
const subscriptionId = searchParams.get("subscriptionId");
if (!subscriptionId) {
return NextResponse.json(
{ error: "Subscription ID is required" },
{ status: 400 }
);
}
try {
// Placeholder logic for fetching payment log data
const paymentLog = [
{
id: "INV123",
amount_paid: 100.0,
status: "paid",
created: new Date().toISOString(),
period_start: new Date().toISOString(),
period_end: new Date().toISOString(),
},
];
return NextResponse.json({ paymentLog });
} catch (error) {
console.error("Error fetching payment log:", error);
return NextResponse.json({ error: error.message }, { status: 500 });
}
}