Conditional use of the PayPal Checkout Add-On Causes Fatal Error

Greetings,

Be advised: I created a video which shows the issue. You can access it from my screencast account here.

The Issue

I am using the PayPal Checkout Add-On for donations. I have created and tested two different forms with a conditional field which states "Make this donation Monthly". The first form uses a checkbox, which causes a fatal error unless a highly non-intuitive approach is used. The second form is slightly more intuitive, and uses radio buttons but also flat out fails.

Be advised: I have conditional PayPal feeds, based on the “Make this donation Monthly” option for BOTH forms (Checkbox and Radio Buttons)

The causes of the failures are as follows: once the use enters an amount, the paypal field is displayed. However, IF -in the case of the the checkbox form- the user THEN checks "Make this donation Monthly" and so triggers the Subscription PayPal feed, the process ends with a Fatal Error.

If -in the case of the the radio button form- the user THEN selects "YES" for "Make this donation Monthly", and so triggers the Subscription PayPal feed, the process also ends with a Fatal Error.

Any Ideas? Thanks,
Preston

p.s. I also submitted this to support in case this is a bug.

What is the 500 Internal Server Error that is being logged (either in the web server error log, PHP error log, WP_DEBUG debug.log or in the email with the stack trace that WordPress will send to the website admin email address)?

Based on the video, here is the error message where I used the checkbox form.

[11-Oct-2021 19:20:03 UTC] PHP Warning:  in_array() expects at least 2 parameters, 1 given in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php on line 2379
[11-Oct-2021 19:20:14 UTC] PHP Warning:  in_array() expects at least 2 parameters, 1 given in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php on line 2379
[11-Oct-2021 19:20:35 UTC] PHP Notice:  Undefined variable: subscriptions_model in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
[11-Oct-2021 19:20:35 UTC] PHP Fatal error:  Uncaught Error: Call to a member function load() on null in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php:138
Stack trace:
#0 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php(110): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->create_subscription(Array, Array, Array, Array)
#1 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php(3513): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->initialize_subscription(Array, Array, Array, Array)
#2 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-payment-addon.php(638): GF_PPCP->subscribe(Array, Array, Array, Array)
#3 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-p in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
[11-Oct-2021 19:20:56 UTC] PHP Warning:  in_array() expects at least 2 parameters, 1 given in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php on line 2379

Thank you for that. Checking the system report in your support ticket, you are using the PayPal Checkout version 2.0.3. The latest available is 2.2. Can you please try updating to that release and see if the issue persists?

Didn’t know that. Will do and report back.

well, I would LOVE to update, but after checking updates, it’s not giving me the option to update. So how to facilitate the update?

You can download it from your downloads page:
https://www.gravityforms.com/my-account/downloads/

And upload and install like any other plugin from your Plugins screen:

OK, it appears I had to completely delete the add-on. Then reinstall it, wherein I got the update. Testing again.

Using Version 2.2: Same scenario, same results.

[11-Oct-2021 20:09:14 UTC] PHP Notice:  Undefined variable: subscriptions_model in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138
[11-Oct-2021 20:09:14 UTC] PHP Fatal error:  Uncaught Error: Call to a member function load() on null in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php:138
Stack trace:
#0 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php(110): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->create_subscription(Array, Array, Array, Array)
#1 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/class-gf-ppcp.php(3547): Gravity_Forms\Gravity_Forms_PPCP\PayPal_Subscriptions_Handler->initialize_subscription(Array, Array, Array, Array)
#2 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-payment-addon.php(638): GF_PPCP->subscribe(Array, Array, Array, Array)
#3 /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityforms/includes/addon/class-gf-p in /home/customer/www/gf.sleepertechnologies.dev/public_html/wp-content/plugins/gravityformsppcp/includes/class-paypal-subscriptions-handler.php on line 138

Thank you for updating. We’ll leave the rest to the support ticket. I updated it with these notes. Thank you.

Okie-Dokie! Thanks for trying. I will report back any results from support.

1 Like

Update: I received a message wherein support was initially unable to recreate the error. So I created another video wherein I successfully recreated the error, using Gravity Forms own demo site. Mainly, because this way I could eliminate any issues around my PC, Server, etc. Not using any of that.

Thanks Preston. I still have your ticket and we’re looking at it today.

Hey Chris,

Any update on this issue? Please advise.

Thanks,
Preston

Hi Preston. The product development team still have your ticket. I will check on it on Wednesday. Thank you.

I’m having the same problem

Hi Sadedar. I recommend opening a support ticket so we can gather some additional details from you as well:

https://www.gravityforms.com/open-support-ticket/technical/

Thank you.

Hi Preston and sadedar. I understand Samuel replied with a temporary workaround for the issue, and referred the issue to the product development team for a permanent fix. You will hear back on your tickets once we have a resolution from the product team. Thank you.

Actually, NO :tired_face:! This is NOT a workaround. I regret to say that after 11 days and two video walkthroughs it appears that, they do not even understand the problem i am reporting. So it begs the question as to what they are planning to “fix” with an update to the addon. Please see my THIRD video on this topic.

Please advise.
(A very frustrated) Preston

For clarity, this is the message I received.

Hi Preston,

Thanks for all the additional information, it was very helpful and allowed me to replicate the issue importing your form and configuring the same feeds setup.
After doing some troubleshooting I found the issue it’s related somehow to the product type used and the field used for conditional logic of feeds.

I have reported this to the product team for getting it fixed in a new version of the add-on.

In the mean time, I found an easy workaround that you can use to make it work:

  1. Replace the Checkboxes field with a Drop down field and set some placeholder text for it, example: Screenshot VHjvAta5RF.png - Droplr

  2. Make this field required to be sure the users selects one choice, example: Screenshot fCZmj3DxhN.png - Droplr

  3. Update your feeds logic to use the new field.

Doing the above allowed me to submit the form without issues no matter if I type the amount first or not.