diff --git a/CRM/Stripe/Webhook.php b/CRM/Stripe/Webhook.php
index 6de268db3f5ea495897336b1c1778b83075cea06..d838ff12e0aa3f6baf38650d6c7830bcac9c8095 100644
--- a/CRM/Stripe/Webhook.php
+++ b/CRM/Stripe/Webhook.php
@@ -41,10 +41,11 @@ class CRM_Stripe_Webhook {
 
     foreach ($result['values'] as $paymentProcessor) {
       $webhook_path = self::getWebhookPath($paymentProcessor['id']);
-      // @todo consider replacing this:
-      $processor = new CRM_Core_Payment_Stripe('', civicrm_api3('PaymentProcessor', 'getsingle', ['id' => $paymentProcessor['id']]));
-      // with
-      // $processor = \Civi\Payment\System::singleton()->getById($paymentProcessor['id']);
+      $processor = \Civi\Payment\System::singleton()->getById($paymentProcessor['id']);
+      if ($processor->stripeClient === NULL) {
+        // This means we only configured live OR test and not both.
+        continue;
+      }
       $processor->setAPIParams();
 
       try {
@@ -200,10 +201,7 @@ class CRM_Stripe_Webhook {
    * @param int $paymentProcessorId
    */
   public static function createWebhook($paymentProcessorId) {
-    // @todo consider replacing this:
-    $processor = new CRM_Core_Payment_Stripe('', civicrm_api3('PaymentProcessor', 'getsingle', ['id' => $paymentProcessorId]));
-    // With:
-    // $processor = \Civi\Payment\System::singleton()->getById($paymentProcessor['id']);
+    $processor = \Civi\Payment\System::singleton()->getById($paymentProcessorId);
     $processor->setAPIParams();
 
     $params = [