• Resolved Karlo

    (@karlob)


    Hi Payment Plugins team,
    we’re seeing an intermittent fatal error during Apple Pay / express checkout updates:

    <code class=””>Critical Uncaught Error: Call to a member function getAddress() on null
    in src/AjaxFrontendHandler.php (around line 84), inside <code class=””>AjaxFrontendHandler::get_update_data().

    From debugging, the issue is that code in the shipping branch assumes <code class=””>PurchaseUnit::getShipping() is always present and calls <code class=””>->getAddress() / <code class=””>->getSelectedOption() directly. In some valid PayPal order states (early/update calls), purchase_unit.shipping is not set yet, so this becomes null and crashes.

    Could you add a null guard before using shipping (e.g. <code class=””>$shipping = $purchase_unit->getShipping(); if ( $shipping ) { … }) so missing shipping blocks are handled safely?

    Environment/context:

    • WooCommerce + CheckoutWC
    • Payment method: ppcp_applepay
    • Hook path includes woocommerce_checkout_update_order_review
    • Plugin version: 2.0.14

    Thanks!

    • This topic was modified 1 month, 1 week ago by Karlo.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Clayton R

    (@mrclayton)

    Hi @karlob

    Thank you for contacting Payment Plugins. We will review this error and respond with feedback. Do you know if the customer attempted to use PayPal originally and then switched to Apple Pay?

    Kind Regards

    Thread Starter Karlo

    (@karlob)

    Hi,

    I don’t have confirmation whether the customer first attempted PayPal and then switched to Apple Pay, but based on the message it seems they went directly with Apple Pay.

    What I do know:

    • The issue occurred on the single product page using the Apple Pay button.
    • The error did not occur when the customer added the product to the cart and used express checkout from there.
    • The payment was successfully completed via Apple Pay from the cart page.

    Thanks!

    Plugin Author Clayton R

    (@mrclayton)

    Hi @karlob

    In the next release, we’re going to be deprecating the AjaxFrontendHandler class where that error occurred because it’s no longer needed.

    Kind Regards

    Thread Starter Karlo

    (@karlob)

    Hi Clayton,
    We encountered the same issue when trying to process refunds via the WooCommerce mobile app. Do you have any information on when the patched version will be released, or if there’s a quick fix we can use in the meantime?

    Plugin Author Clayton R

    (@mrclayton)

    Hi @karlob

    We encountered the same issue when trying to process refunds via the WooCommerce mobile app.

    Can you share the error log? The AjaxFrontendHandler is not involved in the refund process so I’d like to review the error log.

    That code has been in place since nearly the first release of this plugin several years ago so it’s odd that errors would just now start triggering for you.

    You can reach out via the support widget via the WordPress Admin > WooCommerce > PayPal > Support page and we can share the next release.

    Kind Regards

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.