Awaiting feedback PayPal Payment Profile

stromb0li

Well-known member
Affected version
2.3.2
I keep seeing these errors repeat in server logs using the new PayPal payment profile.

Code:
ErrorException: [E_WARNING] Undefined array key "alternate_accounts" src/XF/Payment/PayPal.php:386

#0 src/XF/Payment/PayPal.php(386): XF::handlePhpError(2, '[E_WARNING] Und...', '/var/www/...', 386)
#1 payment_callback.php(57): XF\Payment\PayPal->validatePurchasableData(Object(XF\Payment\CallbackState))
#2 {main}

Using PHP 8.2.15
 
Last edited:
Here's a fix for those that are heavily dependent on the response from PayPal for their add-ons.

Replace line 386 with these two:
PHP:
$alternate_acccounts = empty($options['alternate_accounts']) ? [] : $options['alternate_accounts'];
$accounts = Arr::stringToArray($alternate_acccounts, '#\r?\n#');
 
Last edited:
Looks like there is another after the fix as well:
Code:
ErrorException: [E_WARNING] Undefined array key "primary_account" src/XF/Payment/PayPal.php:388
Generated by: Unknown account Aug 22, 2024 at 5:00 PM
Stack trace
#0 src/XF/Payment/PayPal.php(388): XF::handlePhpError(2, '[E_WARNING] Und...', '/var/www/...', 388)
#1 payment_callback.php(57): XF\Payment\PayPal->validatePurchasableData(Object(XF\Payment\CallbackState))
#2 {main}

Are both primary_account and alternate_accounts expected to be specified? What are these values supposed to be (usernames, user_id, etc)?
 
I keep seeing these errors repeat in server logs using the new PayPal payment profile.
This error is in reference to the old PayPal payment profile. Presumably you have deleted the old payment profile? Is it possible you have old recurring purchasables from the old profile which may be sending IPNs?

Are both primary_account and alternate_accounts expected to be specified? What are these values supposed to be (usernames, user_id, etc)?
They are email addresses, and part of the configuration for the old PayPal payment profile.
 
Presumably you have deleted the old payment profile?
Yes, this is correct that the old payment profile was deleted.

Is it possible you have old recurring purchasables from the old profile which may be sending IPNs
No, we don't have any recurring payments.

They are email addresses, and part of the configuration for the old PayPal payment profile.
Do I need to explicitly turn off IPN for payment even after using the Rest API? I had figured it wouldn't be used for any new transactions post-migration to the new PayPal provider.
 
Last edited:
I got this same error here:

Code:
ErrorException: [E_WARNING] Undefined array key "alternate_accounts" src/XF/Payment/PayPal.php:386

What is the exact cause of the error on this?
 
This error is in reference to the old PayPal payment profile. Presumably you have deleted the old payment profile? Is it possible you have old recurring purchasables from the old profile which may be sending IPNs?


They are email addresses, and part of the configuration for the old PayPal payment profile.

Jeremy, are you saying that if we have old recurring subscriptions, there is no way to get rid of these errors? If I turn off IPN in PayPal, our legacy subs aren't updated. With it enabled, our new subs are sitting in the IPN queue with "retrying" status (of course, they're trying to use the new paypal API) and our server error log is filled with

Screenshot 2025-03-10 at 5.10.35 PM.webp
 
Jeremy is correct, disabling IPN solves the issue / error (you will see a few sporadic entries even post disablement as I saw retry events, however after a day no more showed up).

However, I am still running into this issue where I see 400 bad request responses post disablement on IPN: https://xenforo.com/community/threa...elding-400-bad-request-for-some-users.228058/

Unfortunately disabling IPN is not an option for us, as I'm assuming all old legacy recurring subscriptions would then fail.
 
I get the same error message with the new way of connecting accounts.
The legacy way is what we use. It's a compatibility issue.
 
Back
Top Bottom