Fixed Non-recurring Stripe payments are always "Guest"

DragonByte Tech

Well-known member
Affected version
2.3.0 RC2
This is due to the fact that the customer parameter is only set if the purchase is recurring.

The fix:

Diff:
Index: src/XF/Payment/Stripe.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/XF/Payment/Stripe.php b/src/XF/Payment/Stripe.php
--- a/src/XF/Payment/Stripe.php
+++ b/src/XF/Payment/Stripe.php
@@ -336,15 +336,15 @@
                 throw $controller->exception($controller->error("$errorPhrase $error"));
             }
             $params['plan'] = $plan;
+        }
 
-            $customer = $this->getStripeCustomer($purchaseRequest, $purchase->paymentProfile, $purchase, $error);
-            if (!$customer)
-            {
-                $errorPhrase = \XF::phrase('error_occurred_while_creating_stripe_customer:');
-                throw $controller->exception($controller->error("$errorPhrase $error"));
-            }
-            $params['customer'] = $customer;
-        }
+        $customer = $this->getStripeCustomer($purchaseRequest, $purchase->paymentProfile, $purchase, $error);
+        if (!$customer)
+        {
+            $errorPhrase = \XF::phrase('error_occurred_while_creating_stripe_customer:');
+            throw $controller->exception($controller->error("$errorPhrase $error"));
+        }
+        $params['customer'] = $customer;
 
         return $params;
     }
@@ -1170,4 +1170,4 @@
     {
         return ['stripe'];
     }
-}
\ No newline at end of file
+}
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.0 RC 5).

Change log:
Properly set customer information when payments are processed through Stripe
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom