PayPal Checkout - Uncaught SyntaxError: unexpected token: identifier

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
4 months 2 weeks ago #357513

-- HikaShop version -- : HikaShop Business: 5.0.2
-- Joomla version -- : 5.0.1
-- PHP version -- : 8.2.13
-- Browser(s) name and version -- : Firefox 120.0.1 (64-bit) / Chrome Version 120.0.6099.71 (Official Build) (arm64)
-- Error-message(debug-mod must be tuned on) -- : No payment methods show on the checkout/confirm page when choosing the PayPal Checkout plugin.

The console error is:
Uncaught SyntaxError: unexpected token: identifier

No additional on-screen errors appear, even with error reporting set to max and debug enabled.

We are attempting to replace the old-school PayPal plugin with the new PayPal Checkout plugin using the RestAPI. We've swapped a few sites over to this so far and this is the first time we've experienced any issue with setup. It's also the first Joomla 5 site on which we've attempted to use the PayPal Checkout plugin. Related? Maybe.

The plugin config looks good and we see the "success" message for the Client ID/Secret Key/Merchant ID config.

However, during checkout no payment methods show on the checkout/confirm page when choosing the PayPal Checkout plugin payment option.

The console error is: Uncaught SyntaxError: unexpected token: identifier

No additional on-screen errors appear, even with error reporting set to max and debug enabled in Joomla and in the payment plugin.


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
4 months 2 weeks ago #357516

Hi,

The javascript error is indeed the culprit.
Now, there is no "identifier" in the PayPal Checkout plugin. And if I look online for that error message, it points at something linked to Jquery: stackoverflow.com/questions/64900999/unc...ted-token-identifier
Also, you didn't provide the file and line number of the error message. On the right side of the screen where you have the error message, you should see both.
They will point at the area of the page where the javascript error happens.
It's likely to come from a third party extension.
I also tried to check directly on your website, but I couldn't find any product I could add to the cart in order to access the checkout. So I would need precise instructions to reproduce the issue so that I could directly look at the problem.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
4 months 2 weeks ago #357534

I believe the file and line number are shown in the screenshot I attached of the console error.


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
4 months 2 weeks ago #357536

Hi,

It says that it's on the HTML of the page on line 584. But it doesn't say what's there.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
4 months 2 weeks ago #357576

This is what's on the line being reported by the JS error:

var errormsg = "The payment request was refused by PayPal. <a href=' domain.com/index.php?option=com_hikashop...er_id=143&Itemid=817 ' title="Please click here to return to the checkout.">Please click here to return to the checkout.</a>";


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
4 months 2 weeks ago #357582

Sent a PM


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters

Please Log in or Create an account to join the conversation.

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
4 months 2 weeks ago #357578

Hi,

You have the same error as reported here:
www.hikashop.com/forum/checkout/907429-p...d/357432.html#357442
The "title" attribute added to this link uses double quotes which breaks the javascript of PayPal Checkout.
The user MBwebdesign on that other thread said that this title was wrongfully added by the plugin "Seofli".
I suppose you must use this same plugin.
I would recommend reporting the issue to the developer of the plugin as it should not try to do this inside javascript code.
What you can do to circumvent the problem is to create a translation override for the translation key PAYMENT_REQUEST_REFUSED_BY_PAYPAL_CANCEL_URL to add the title so that the plugin doesn't try to do it.

Please Log in or Create an account to join the conversation.

  • Posts: 195
  • Thank you received: 13
  • Hikashop Business
4 months 2 weeks ago #357589

I had never heard of such a plugin but I checked the extension list to be safe. Yes, sure enough, the seofli plugin was installed. I guess our client installed it at some point in the past. I disabled the plugin and now the PayPal checkout buttons are loading. Whew.

Thanks for sticking with me through this one! :-)


3by400, Inc.
3by400.com
Websites that Work, Marketing that Matters

Please Log in or Create an account to join the conversation.

Time to create page: 0.072 seconds
Powered by Kunena Forum