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 null
File:
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 error
Actual 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 Button
Steps to Reproduce:
Place an order using PayPal Smart Button
Go to Admin Panel → Orders
Create a refund
Error appears
Additional 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