Fix payment logic

This commit is contained in:
DariusIII
2026-08-19 10:00:41 +02:00
parent 3b32912ac4
commit ff95557d2e
@@ -99,6 +99,15 @@ class BtcPaymentController extends BasePageController
return response('Not Found', 404);
}
$existingPayment = Payment::query()->where('invoice_id', '=', $payload['invoiceId'])->first();
if ($existingPayment === null) {
Log::channel('btc_payment')->error('InvoiceSettled webhook received but no payment recorded for invoice: '.$payload['invoiceId'].' (webhook: '.($payload['webhookId'] ?? 'unknown').', buyer: '.($payload['metadata']['buyerEmail'] ?? 'unknown').')');
return response('Not Found', 404);
}
Log::channel('btc_payment')->info('Duplicate InvoiceSettled webhook for already settled invoice: '.$payload['invoiceId']);
}
return response('OK', 200);