From fe3055a2ecb8c525767ba74933cf60e9b100f5d5 Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Mon, 7 Mar 2022 15:04:08 -0500 Subject: [PATCH] Expose payment processor error from PaymentProcessor.pay --- api/v3/PaymentProcessor.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/v3/PaymentProcessor.php b/api/v3/PaymentProcessor.php index 06587f00ca..803f38dce4 100644 --- a/api/v3/PaymentProcessor.php +++ b/api/v3/PaymentProcessor.php @@ -123,7 +123,8 @@ function civicrm_api3_payment_processor_pay($params) { if (empty($code)) { $code = 'EXTERNAL_FAILURE'; } - throw new API_Exception('Payment failed', $code, $errorData, $e); + $message = $e->getMessage() ?? 'Payment Failed'; + throw new API_Exception($message, $code, $errorData, $e); } return civicrm_api3_create_success(array($result), $params); } -- 2.25.1