diff --git a/app/Http/Requests/CreatePaymentAPIRequest.php b/app/Http/Requests/CreatePaymentAPIRequest.php index f7a521c4c918..c6b4657080c3 100644 --- a/app/Http/Requests/CreatePaymentAPIRequest.php +++ b/app/Http/Requests/CreatePaymentAPIRequest.php @@ -33,7 +33,11 @@ class CreatePaymentAPIRequest extends PaymentRequest $this->invoice = $invoice = Invoice::scope($this->invoice_id) ->withArchived() ->invoices() - ->firstOrFail(); + ->first(); + + if (! $this->invoice) { + abort(404, 'Invoice was not found'); + } $this->merge([ 'invoice_id' => $invoice->id,