diff --git a/src/WebformCivicrmPostProcess.php b/src/WebformCivicrmPostProcess.php index 6f918dfbb..6ff2b3d3a 100644 --- a/src/WebformCivicrmPostProcess.php +++ b/src/WebformCivicrmPostProcess.php @@ -2085,7 +2085,9 @@ private function submitIPNPayment() { $paymentProcessor->doPayment($params); } catch (\Civi\Payment\Exception\PaymentProcessorException $e) { - drupal_set_message(ts('Payment approval failed with message: ') . $e->getMessage(),'error'); + \Drupal::messenger()->addError(ts('Payment approval failed with message: %error ', [ + '%error' => $e->getMessage(), + ])); \CRM_Utils_System::redirect($this->getIpnRedirectUrl('cancel')); }