diff --git a/CRM/Core/Payment/StripeIPN.php b/CRM/Core/Payment/StripeIPN.php
index 754adda3218b05b3c165e088f582baf013f152d0..fc20aa31aced451fab5c074ab88ea4d0157164ef 100644
--- a/CRM/Core/Payment/StripeIPN.php
+++ b/CRM/Core/Payment/StripeIPN.php
@@ -412,11 +412,20 @@ class CRM_Core_Payment_StripeIPN {
 
         if ($this->contribution['contribution_status_id'] == $pendingContributionStatusID) {
           // If this contribution is Pending, set it to Failed.
+
+          // To obtain the failure_message we need to look up the charge object
+          $failureMessage = '';
+          if ($this->charge_id) {
+            $stripeCharge = $this->_paymentProcessor->stripeClient->charges->retrieve($this->charge_id);
+            $failureMessage = CRM_Stripe_Api::getObjectParam('failure_message', $stripeCharge);
+            $failureMessage = is_string($failureMessage) ? $failureMessage : '';
+          }
+
           $params = [
             'contribution_id' => $this->contribution['id'],
             'order_reference' => $this->invoice_id,
             'cancel_date' => $this->receive_date,
-            'cancel_reason' => $this->retrieve('failure_message', 'String'),
+            'cancel_reason'   => $failureMessage,
           ];
           $this->updateContributionFailed($params);
         }
diff --git a/CRM/Stripe/Api.php b/CRM/Stripe/Api.php
index 18a6594401b7711d2a0dd432cceb684c27dce971..f44c626335b693601188e4bab6f0b45299175e0d 100644
--- a/CRM/Stripe/Api.php
+++ b/CRM/Stripe/Api.php
@@ -103,10 +103,8 @@ class CRM_Stripe_Api {
             return (string) $stripeObject->customer;
 
           case 'failure_message':
-            if (!empty($stripeObject->charge)) {
-              $stripeCharge = \Stripe\Charge::retrieve($stripeObject->charge);
-              return (string) $stripeCharge->failure_message;
-            }
+            // This is a coding error, but it looks like the general policy here is to return something. Could otherwise consider throwing an exception.
+            Civi::log()->error("Coding error: CRM_Stripe_Api::getObjectParam failure_message is not a property on a Stripe Invoice object. Please alter your code to fetch the Charge and obtain the failure_message from that.");
             return '';
 
         }