• Resolved jamesshulman

    (@jamesshulman)


    Hello,

    Upon enabling Apple Pay & PaymentRequest Gateway, I am receiving the following error message on the top of my checkout page on Apple devices:

    undefined is not an object (evaluating ‘this.get_currency().toLowerCase’)

    The message above only shows on Apple devices and disappears when Apple Pay and PaymentRequest Gateway is disabled so I believe its related to one or both options.

    • This topic was modified 5 years, 9 months ago by jamesshulman.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Clayton R

    (@mrclayton)

    Hi @jamesshulman

    What is your website url? That message can appear if the html on your checkout page doesn’t contain the required variables needed by the Stripe plugin.

    That could happen if your checkout page is rendering html after the page loads or if you are using aggressive caching that prevents the Stripe plugin’s $gateway->payment_fields() call from being output to the page.

    Kind Regards,

    Thread Starter jamesshulman

    (@jamesshulman)

    Hey Clayton,

    Thank you for the rapid response. The website URL is: https://www.theteaclub.com. I do believe that the caching plugins that are in use on the site are set to not cache/ignore certain pages including the checkout page. I can try to clear the cache for the checkout page just to make sure. What is strange is that this issue only shows when enabling those payment methods and never came up prior when using the Credit Card method.

    I will re-enable the methods so that the issue comes up for debugging purposes temporarily.

    • This reply was modified 5 years, 9 months ago by jamesshulman.
    Thread Starter jamesshulman

    (@jamesshulman)

    Confirmed the issue came back up on my Apple phone after enabling the Apple Pay method. Clearing caching did not seem to fix the issue either 🙁

    Plugin Author Clayton R

    (@mrclayton)

    Hi @jamesshulman

    Please leave those payment methods enabled and I’ll test your site. I’ll need about 15 minutes and will respond back when I’ve finished my review of your checkout page.

    The currency is output with the payment gateway html so if you’re seeing the Apple Pay option the currency should be there.

    Kind regards,

    Thread Starter jamesshulman

    (@jamesshulman)

    No problem. I will leave them enabled for now.

    I am noticing this issue to come up in Safari browser as well as the Google browser on the Apple device. When this issue comes up, I also do not see the Apple Pay button on the page.

    Plugin Author Clayton R

    (@mrclayton)

    Hi @jamesshulman,

    I have discovered the issue. Your checkout page is loading a cached version of the wc-stripe.min.js file which used to fetch the currency from a hidden input called '#wc_stripe_currency.

    That input is no longer available in versions 3.1.8+ so that’s why you’re seeing that error on the checkout page. You need to clear the wc-stripe.min.js file from your cache plugin so it gets the newest file.

    Kind Regards,

    Thread Starter jamesshulman

    (@jamesshulman)

    Hmm… not sure I follow. I tried clearing the cache on the site from both the server copy as well as CloudFlare (purge all). The issue seems to still exist…

    Not sure why this issue only exists on Apple devices with the Apple Pay method enabled and no other time?

    Thread Starter jamesshulman

    (@jamesshulman)

    Also on my device, the issue seems to appear on only the Google browser on the Apple device and does not come up when using the Safari browser. With the Safari browser, the button shows and no issue with the JavaScript is shown?

    Plugin Author Clayton R

    (@mrclayton)

    Hi @jamesshulman,

    The reason you see this error when you have Apple Pay or the Payment Request gateway enabled is because when the wallet is opening, Stripe requires that an object that contains the order currency be past.

    The Stripe plugin fetches that currency from an object stored in an HTML input field. The old way of doing it was to fetch the currency from an input named #wc_stripe_currency but that field no longer exists in new versions of the plugin so it throws an error which you see on the checkout page.

    Here is screenshots showing that your checkout page is serving a cached version of the wc-stripe.min.js file.

    https://imgur.com/a/jKCQ4mE

    Here is the most recent version of the plugin:
    https://plugins.trac.ww.wp.xz.cn/browser/woo-stripe-payment/tags/3.2.0/assets/js/frontend/wc-stripe.js#L155

    Notice how the get_currency function changed. Your site is referencing the old version.

    • This reply was modified 5 years, 9 months ago by Clayton R.
    Thread Starter jamesshulman

    (@jamesshulman)

    Hey Clayton,

    Thank you very much for the extremely fast, detailed, and helpful support.

    You are correct!!! After ensuring the server cache was cleared, I cleared the cache on my device as well and the issue seems to have resolved 🙂

    This can be closed.

    • This reply was modified 5 years, 9 months ago by jamesshulman.
Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Javascript Issues when using Apple Pay/PaymentRequest Gateway’ is closed to new replies.