Fix paypal subscription 'things don't seem to be working at the moment' if frequency_...
authorMatthew Wire <mjw@mjwconsult.co.uk>
Mon, 26 Sep 2022 10:03:04 +0000 (11:03 +0100)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Mon, 26 Sep 2022 10:05:40 +0000 (11:05 +0100)
CRM/Core/Payment/PayPalImpl.php

index f0b79177f8ce32f6eb2bbbe85a17de7852c47dea..acc2fe3aeb7512e1892cb7e9c8a8d22524e73001 100644 (file)
@@ -1017,10 +1017,11 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
         throw new CRM_Core_Exception(ts('Recurring contribution, but no database id'));
       }
 
+      // See https://developer.paypal.com/api/nvp-soap/paypal-payments-standard/integration-guide/Appx-websitestandard-htmlvariables/#link-recurringpaymentvariables
       $paypalParams += [
         'cmd' => '_xclick-subscriptions',
         'a3' => $this->getAmount($params),
-        'p3' => $params['frequency_interval'],
+        'p3' => $params['frequency_interval'] ?? 1,
         't3' => ucfirst(substr($params['frequency_unit'], 0, 1)),
         'src' => 1,
         'sra' => 1,