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?
 
Back
Top Bottom