From 269e9371a9e8a1f7327d5eef6230012eb80f2ced Mon Sep 17 00:00:00 2001 From: "Matthew Wire (MJW Consulting)" <mjw@mjwconsult.co.uk> Date: Thu, 14 Nov 2019 15:24:49 +1300 Subject: [PATCH] Fix #125 Thousands of failed/spam transactions for charge.failed webhook --- CRM/Core/Payment/StripeIPN.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CRM/Core/Payment/StripeIPN.php b/CRM/Core/Payment/StripeIPN.php index b62befd8..18761de2 100644 --- a/CRM/Core/Payment/StripeIPN.php +++ b/CRM/Core/Payment/StripeIPN.php @@ -237,6 +237,12 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { // One-time donation and per invoice payment. case 'charge.failed': + // If we don't have a customer_id we can't do anything with it! + // It's quite likely to be a fraudulent/spam so we ignore. + if (empty(CRM_Stripe_Api::getObjectParam('customer_id', $this->_inputParameters->data->object))) { + return TRUE; + } + $this->setInfo(); $params = [ 'id' => $this->contribution['id'], -- GitLab