diff --git a/CRM/Core/Payment/Stripe.php b/CRM/Core/Payment/Stripe.php index a13c81733957c5834f30ba4b326607f668d1415f..6a5eac88f2fc9af19c2e15c1b3543308c2b73416 100644 --- a/CRM/Core/Payment/Stripe.php +++ b/CRM/Core/Payment/Stripe.php @@ -277,14 +277,18 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment { if (empty($form->_paymentProcessor)) { return; } - // Determine if we are dealing with a webform in CiviCRM 4.7. Those don't have a - // _paymentProcessors array and only have one payprocesssor. - if (in_array(get_class($form), array('CRM_Financial_Form_Payment', 'CRM_Contribute_Form_Contribution'))) { + + // When called from admin backend (eg via CRM_Contribute_Form_Contribution, CRM_Member_Form_Membership) + // the isBackOffice flag will be set to true. + // But if called via webform in CiviCRM 4.7: isBackOffice=NULL and for is of class CRM_Financial_Form_Payment or CRM_Contribute_Form_Contribution + // Those don't have a _paymentProcessors array and only have one payprocesssor. + if (!empty($form->isBackOffice) + || (in_array(get_class($form), array('CRM_Financial_Form_Payment', 'CRM_Contribute_Form_Contribution')))) { return $stripe_ppid = $form->_paymentProcessor['id']; } else { // Find a Stripe pay processor ascociated with this Civi form and find the ID. - // $payProcessors = $form->_paymentProcessors; + // $payProcessors = $form->_paymentProcessors; $payProcessors = CRM_Core_Form_Stripe::get_ppids($form); foreach ($payProcessors as $payProcessor) { if ($payProcessor['class_name'] == 'Payment_Stripe') {