Files
pagodera/app/api/donations/verify/route.ts
T
Evandro Fonseca Junior 01e97eb078 feat: add donation support with footer card and navigation
Add donation functionality to encourage community support, including a footer card on the home page, a highlighted "Apoiar" link in the header, and comprehensive English messages for the donation section to promote transparency and user engagement.
2025-10-26 18:14:53 -03:00

37 lines
971 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { abacatePay } from "@/lib/abacatepay";
export async function GET(request: NextRequest) {
try {
const { searchParams } = new URL(request.url);
const billingId = searchParams.get("billingId");
if (!billingId) {
return NextResponse.json(
{ success: false, error: "ID da cobrança é obrigatório" },
{ status: 400 }
);
}
const billing = await abacatePay.getBillingStatus(billingId);
return NextResponse.json({
success: true,
status: billing.status,
amount: billing.amount,
createdAt: billing.createdAt,
expiresAt: billing.expiresAt,
});
} catch (error) {
console.error("Billing verification error:", error);
return NextResponse.json(
{
success: false,
error:
error instanceof Error ? error.message : "Erro ao verificar cobrança",
},
{ status: 500 }
);
}
}