diff --git a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php index 8dc5567beb65..b29c6ab06a18 100644 --- a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php +++ b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php @@ -80,7 +80,7 @@ class ValidRefundableRequest implements Rule $invoice = Invoice::whereId($invoice['invoice_id'])->whereCompanyId($payment->company_id)->withTrashed()->first(); if ($payment->invoices()->exists()) { - $paymentable_invoice = $payment->invoices->where('invoice_id', $invoice->id)->first(); + $paymentable_invoice = $payment->invoices->where('id', $invoice->id)->first(); if (! $paymentable_invoice) { $this->error_msg = ctrans('texts.invoice_not_related_to_payment', ['invoice' => $invoice->hashed_id]);