diff --git a/api/v3/Stripe/Listevents.php b/api/v3/Stripe/Listevents.php
index 9800d9cd115f7bb6c861a3872d53d9b2d3d26e6e..8a896c56823d841fe2daf5d60b869882b52b0d7b 100644
--- a/api/v3/Stripe/Listevents.php
+++ b/api/v3/Stripe/Listevents.php
@@ -358,6 +358,7 @@ function civicrm_api3_stripe_Listevents($params) {
     $out = [];
     $count = 0;
     foreach($data_list['data'] as $data) {
+      $count++;
       if ($count > $limit) {
         break;
       }
@@ -449,7 +450,6 @@ function civicrm_api3_stripe_Listevents($params) {
           }
         }
       }
-      $count++;
       $out[] = $item;
     }
   }