Duplicate Payment(i.e financial transactions) recorded
Steps to replicate:
Create a contribution from online page using stripe payment.
Expected Behaviuor:
Creates only single payment i.e financial transaction for a contribution.
Actual Behaviour:
Creates two payments i.e financial transaction for a contribution.
Reason:
This is not true for most of the cased but happens only when server is busy or has too many contribe module or Civi rules associated with Contribution or Membership etc.
When the server is busy and while Civi processes contribution(after payment is done) it gets response from Stripe via webhook same time. In both cases the Contribution status is Pending hence it records payments in both cases resulting in duplicate payments.
I assumed the IPN response would update the contribution status from Pending to Completed, but when I looked at the code, it does look like its updating the contribution to completed.
ATM I have temporary fix in place to not update contribution in processPaymentIntent()
but allowed IPN to change the status.
diff --git a/civicrm_extensions/stripe/CRM/Core/Payment/Stripe.php b/civicrm_extensions/stripe/CRM/Core/Payment/Stripe.php
index 784ff159..38b43eef 100644
--- a/civicrm_extensions/stripe/CRM/Core/Payment/Stripe.php
+++ b/civicrm_extensions/stripe/CRM/Core/Payment/Stripe.php
@@ -837,7 +837,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
}
// Success!
// Set the desired contribution status which will be set later (do not set on the contribution here!)
- $params = $this->setStatusPaymentCompleted($params);
+ //$params = $this->setStatusPaymentCompleted($params);
// Transaction ID is always stripe Charge ID.
$this->setPaymentProcessorTrxnID($stripeCharge->id);
// @fixme: This is for compatibility with mjwshared 1.0 - drop once we require 1.1