Replace remote with local repo
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { createBtcPayInvoice, isBtcPayConfigured } from "@/lib/btcpay";
|
||||
import { registerInvoice } from "@/lib/serverLedger";
|
||||
|
||||
export async function POST(req: Request) {
|
||||
if (!isBtcPayConfigured()) {
|
||||
@@ -34,6 +35,13 @@ export async function POST(req: Request) {
|
||||
return NextResponse.json({ ok: false, error: result.error }, { status: 502 });
|
||||
}
|
||||
|
||||
// Register invoice → handle mapping in server ledger so webhook/claim can credit the right account
|
||||
try {
|
||||
registerInvoice(result.invoice.id, handle.trim());
|
||||
} catch {
|
||||
// Non-fatal — client can still poll and claim manually
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
ok: true,
|
||||
invoiceId: result.invoice.id,
|
||||
|
||||
Reference in New Issue
Block a user