diff --git a/CRM/Core/Payment/Stripe.php b/CRM/Core/Payment/Stripe.php
index d3687ee89b9ac22751c2f4c0e4fd77329de4038f..b8f8f4e2aa990ddc9b9f0e20472c9e7e514a7d0b 100644
--- a/CRM/Core/Payment/Stripe.php
+++ b/CRM/Core/Payment/Stripe.php
@@ -259,10 +259,11 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
     // Get live/test mode.
     switch ($this->_mode) {
       case 'test':
-        $transaction_mode = 0;
+        $params['transaction_mode'] = $transaction_mode = 0;
         break;
       case 'live':
-        $transaction_mode = 1;
+        $params['transaction_mode'] = $transaction_mode = 1;
+        break;
     }
 
     // Get proper entry URL for returning on error.
@@ -550,13 +551,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
    * @public
    */
   function doRecurPayment(&$params, $amount, $stripe_customer) {
-    switch ($this->_mode) {
-      case 'test':
-        $transaction_mode = 0;
-        break;
-      case 'live':
-        $transaction_mode = 1;
-    }
+    $transaction_mode = $params['transaction_mode'];
 
     // Get recurring contrib properties.
     $frequency = $params['frequency_unit'];