Refund Error: Trying to access array offset on null (PayPal Smart Button)
-
Hello Support Team,
I’m encountering an issue when creating a refund in Bagisto using the PayPal Smart Button payment method.
Error Message:
Trying to access array offset on value of type nullFile:
packages/Webkul/Admin/src/Listeners/Refund.php (line 46)Relevant Code:
$paypalOrderID = $order->payment->additional['orderID'];
Issue Description:
When I attempt to create a refund from the admin panel, the system throws the above error. It appears that $order->payment->additional is null, which causes the failure when trying to access the orderID.Expected Behavior:
The system should either:Process the refund correctly via PayPal, or
Gracefully handle missing payment additional data without throwing an errorActual Behavior:
The refund process crashes due to accessing a null value.Environment Details:
Bagisto Version: 2.1
Laravel Version: 11
PHP Version: 8.0
Payment Method: PayPal Smart ButtonSteps to Reproduce:
Place an order using PayPal Smart Button
Go to Admin Panel → Orders
Create a refund
Error appearsAdditional Notes:
It seems that the additional field in the payment record does not always contain orderID. Please advise whether this should always be stored, or if additional validation is required before accessing it.I would appreciate your guidance on the correct handling of this case.
Best regards,
Ahed -
Hello @Zeryab
We have already raised this issue. You can track and review it through the following link, and also share your observations there:
https://github.com/bagisto/bagisto/issues/11294
Regards