I have set up a test PayPay Express payment processor and created a contribution page that allows the user to create a recurring donation.

When I use this page, I get the "PayPal Checkout" button appears and takes me to PayPal. Everything proceeds as expected with the PayPal screens and I get taken back to my site, where I am told I need to click the "Make Contribution" button. I do that and get back a page that says:

Notice: Undefined index: returnURL in CRM_Core_Payment_PayPalImpl->createRecurringPayments() (line 372 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
Notice: Undefined index: cancelURL in CRM_Core_Payment_PayPalImpl->createRecurringPayments() (line 373 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
Notice: Undefined index: installments in CRM_Core_Payment_PayPalImpl->createRecurringPayments() (line 380 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
Notice: Undefined index: transactionid in CRM_Core_Payment_PayPalImpl->createRecurringPayments() (line 399 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
Notice: Undefined index: amt in CRM_Core_Payment_PayPalImpl->createRecurringPayments() (line 400 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
Notice: Undefined index: feeamt in CRM_Core_Payment_PayPalImpl->createRecurringPayments() (line 401 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
Notice: Undefined index: settleamt in CRM_Core_Payment_PayPalImpl->createRecurringPayments() (line 402 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
Notice: Undefined index: paymentstatus in CRM_Core_Payment_PayPalImpl->createRecurringPayments() (line 406 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
Notice: Undefined index: pendingreason in CRM_Core_Payment_PayPalImpl->createRecurringPayments() (line 407 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
Notice: Undefined index: payment_status_id in CRM_Contribute_BAO_Contribution_Utils::processConfirm() (line 198 of /var/www/html/SOTS/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution/Utils.php).

It also says that the payment was successful, but when I look at it in CiviCRM, it has a status of "Pending" and my PayPal account shows no notification was sent.

I have done some digging. After the "Make Contribution" button is pressed, the application ends up in PayPalImpl.php, createRecurringPayments(...). This never sets the $param['payment_status_id']. Later on, the application gets to Confirm.php, completeTransaction(), which looks for $result['payment_status_id'] of 1. Only if this is true does the transaction get marked as completed.

So, the question is, should createRecurringPayments() set the payment_status_id, and to what?

Note that if I try with a single donation, it works ok (i.e. the transaction is marked as complete).


  • The code implies that it should be pending as it is not completed in realtime? ``` if (!empty($params['is_recur'])) { // See comment block. $params['payment_status_id'] = array_search('Pending', $statuses); } else { $params['payment_status_id'] = array_search('Completed', $statuses); } ```
    – user4278
    Apr 17, 2018 at 21:08
  • To be honest, having looked at the code in more detail, I am not sure how much of it actually works. For example, if you are setting up a recurring payment using the PayPal Standard payment processor, it sets up the agreement and takes the first payment. However, the Express payment processor doesn't (it should be setting the "INITAMT" parameter to do that), however the code seems to be expecting that it will. Unfortunately, I don't know enough about CiviContribute or PayPal to say whether or not what it is doing is correct in terms of setting up the recurring payment. Apr 19, 2018 at 8:10

1 Answer 1


Ok, I think I have finally got to the bottom of this.

Firstly, one of the problems was that I had not got the payment notifications set up in PayPal (mea culpa).

However, even with this fixed, the notifications were not being processed. I narrowed this down to the handlePaymentExpress() method in PayPalProIPN.php. There are two errors here, both related to the "is test" status. At line 578, it attempts to get the Contribution record. However the call:

   $result = civicrm_api3('contribution', 'getsingle', array('invoice_id' => $input['invoice']));

only works for live contributions, it doesn't find test contributions.

The other error is at line 597:

    $paymentProcessorID = self::getPayPalPaymentProcessorID();

Again, this only works for live, not test.

I'd love to log the issue on the CiviCRM website, but two requests for an account have been ignored. Oh well.

  • Can you ping me (@bgm) on chat.civicrm.org, with your email/username on civicrm.org?
    – bgm
    Apr 24, 2018 at 2:07
  • I did manage to get a logon to the issues board and raise the issue, but I have been unable to login since Apr 26, 2018 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.