Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Refund Error: Trying to access array offset on null (PayPal Smart Button)

    Bug Report
    2
    2
    32
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      Zeryab last edited by

      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

      1 Reply Last reply Reply Quote 0
      • R
        rishabh-webkul last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post