diff --git a/BTCPayServer/PaymentRequest/PaymentRequestHub.cs b/BTCPayServer/PaymentRequest/PaymentRequestHub.cs index 6a5af97ac..c3fda40e0 100644 --- a/BTCPayServer/PaymentRequest/PaymentRequestHub.cs +++ b/BTCPayServer/PaymentRequest/PaymentRequestHub.cs @@ -116,9 +116,9 @@ namespace BTCPayServer.PaymentRequest { if (evt is InvoiceEvent invoiceEvent) { - var paymentRequestId = - PaymentRequestRepository.GetPaymentRequestIdFromOrderId(invoiceEvent.Invoice.OrderId); - + var paymentRequestId = PaymentRequestRepository.GetPaymentRequestIdFromOrderId(invoiceEvent.Invoice.OrderId); + if (paymentRequestId == null) + return; if (invoiceEvent.Name == InvoiceEvent.ReceivedPayment) { await _PaymentRequestService.UpdatePaymentRequestStateIfNeeded(paymentRequestId); diff --git a/BTCPayServer/PaymentRequest/PaymentRequestService.cs b/BTCPayServer/PaymentRequest/PaymentRequestService.cs index ab23dbe1c..e769298dc 100644 --- a/BTCPayServer/PaymentRequest/PaymentRequestService.cs +++ b/BTCPayServer/PaymentRequest/PaymentRequestService.cs @@ -35,7 +35,6 @@ namespace BTCPayServer.PaymentRequest public async Task UpdatePaymentRequestStateIfNeeded(string id) { var pr = await _PaymentRequestRepository.FindPaymentRequest(id, null); - await UpdatePaymentRequestStateIfNeeded(pr); }