diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index b40e81600cfe..53d6828688ec 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -150,9 +150,11 @@ class PaymentService extends BaseService if (Auth::user()->can('edit', $payment)) { $amount = !empty($params['amount']) ? floatval($params['amount']) : null; $accountGateway = $payment->account_gateway; - $paymentDriver = $accountGateway->paymentDriver(); - if ($paymentDriver->refundPayment($payment, $amount)) { - $successful++; + if ($accountGateway = $payment->account_gateway) { + $paymentDriver = $accountGateway->paymentDriver(); + if ($paymentDriver->refundPayment($payment, $amount)) { + $successful++; + } } } }