diff --git a/stripe.php b/stripe.php
index f77010122ff7833b4c3e1dbed9424589081b441e..0783174b7eaf6f827923cdeb284408b816347646 100644
--- a/stripe.php
+++ b/stripe.php
@@ -203,3 +203,20 @@ function stripe_civicrm_managed(&$entities) {
       }
     }
   }
+
+/*
+ * Implementation of hook_idsException.
+ *
+ * Ensure webhooks don't get caught in the IDS check.
+ */
+function stripe_civicrm_idsException(&$skip) {
+  // Handle old method.
+  $skip[] = 'civicrm/stripe/webhook';
+  // Handle new method. Get the IDs of the Stripe payment processor.
+  $sql = "SELECT pp.id FROM civicrm_payment_processor pp JOIN civicrm_payment_processor_type
+    pt ON pp.payment_processor_type_id = pt.id AND pt.name = 'Stripe'";
+  $dao = CRM_Core_DAO::executeQuery($sql);
+  while($dao->fetch()) {
+    $skip[] = 'civicrm/payment/ipn/' . $dao->id;
+  }
+}