Post by arun_wirebox » Tue Oct 12, 2021 9:26 pm

1. Your Exact OpenCart Version (e.g. 1.5.6.4, 2.3.0.2, 3.0.6.0, etc.) 2.2.0
2. Used Template/Theme Journal 2.15.1 (but that is not the issue I am investigating)
3. (Additional) Installed Extension(s)
4. (Additional) Installed Translation(s)

Hi, I have downloaded https://www.opencart.com/index.php?rout ... n_id=27099 for a client's OpenCart staging site, the version of the extension that was released on Nov, 23 2016 as it's compatible with OC 2.2.0, the extension version being 1.2.

I have installed the requisite Composer dependencies, i.e. vendor/klarna/kco_root in the project root, and have not been encountering any issues from that.

I have enabled the Klarna Account and Klarna Invoice payment extensions on the staging site as I am not sure if the Klarna Checkout payment extension depends on them (it looks like it might depend on Klarna Account being enabled) - EDIT: it looks like Klarna Checkout may be independent of these two, as they keep on disabling themselves.

The issue is that I can't seem to find Klarna Checkout as an available payment method on the checkout page.

Under Extensions > Payments > Klarna Checkout > Settings in the admin interface, of the values I can share, please refer to the following:

Allow Separate Shipping Address - No
Date Of Birth Mandatory (UK stores only) -No
Title Mandatory (UK stores only) - No
Allow Newsletter Signup - No
Total - N/A (not set)
Terms & Conditions - 0% Interest Free Credit
Status - Enabled

Under Extensions > Payments > Klarna Checkout > Order Statuses in the admin interface, everything is set to Canceled.

Under Extensions > Payments > Klarna Checkout > Accounts in the admin interface, of the values I can share, please refer to the following:

Environment (Live/Test): Test
Country: United Kingdom
Shipping Countries: UK Shipping (the only other available value in the select dropdown is UK VAT Zone)
Currency: Pound Sterling
Locale: en-gb
API Location: Europe (North America is the only available value in the select dropdown)

I haven't added the Klarna Checkout module to the Checkout page layout, as when I did this on the staging site, it caused both the cart and checkout pages to display a white screen when I visited them with a non empty cart.

I've noticed that function getMethod() - spanning lines 57 - 60 on catalog/model/payment/klarna_checkout.php - returns an empty array, whereas on the checkout page, the only available payment method doesn't return an empty array in its getMethod function, so suspect this is causing an issue?

I also suspect that, since I didn't set a total, Klarna Checkout should work regardless of total, but I am setting the total too as I am writing this to test.

I have also set Klarna Checkout to start logging, and will see if this turns up anything new.

At the moment, I cannot see anything in either the web server error log for the staging site, nor in system/storage/logs/error.log

I hope I've provided enough information, but am more than happy to provide any further details.

Thanks in advance.
Last edited by arun_wirebox on Thu Oct 14, 2021 4:46 am, edited 1 time in total.

Newbie

Posts

Joined
Wed Jul 14, 2021 6:40 pm

Post by arun_wirebox » Tue Oct 12, 2021 9:40 pm

There are some instructions in the comments section on https://www.opencart.com/index.php?rout ... n_id=27099 from someone called juhosyrj, I tried following them to no avail.

Also confirming that SSL is enabled for the staging site, and that I followed the extension developer's instructions on this page too.

Newbie

Posts

Joined
Wed Jul 14, 2021 6:40 pm

Post by straightlight » Tue Oct 12, 2021 11:11 pm

arun_wirebox wrote:
Tue Oct 12, 2021 9:26 pm
1. Your Exact OpenCart Version (e.g. 1.5.6.4, 2.3.0.2, 3.0.6.0, etc.) 2.2.0
2. Used Template/Theme Journal 2.15.1 (but that is not the issue I am investigating)
3. (Additional) Installed Extension(s)
4. (Additional) Installed Translation(s)

Hi, I have downloaded https://www.opencart.com/index.php?rout ... n_id=27099 for a client's OpenCart staging site, the version of the extension that was released on Nov, 23 2016 as it's compatible with OC 2.2.0, the extension version being 1.2.

I have installed the requisite Composer dependencies, i.e. vendor/klarna/kco_root in the project root, and have not been encountering any issues from that.

I have enabled the Klarna Account and Klarna Invoice payment extensions on the staging site as I am not sure if the Klarna Checkout payment extension depends on them (it looks like it might depend on Klarna Account being enabled) - EDIT: it looks like Klarna Checkout may be independent of these two, as they keep on disabling themselves.

The issue is that I can't seem to find Klarna Checkout as an available payment method on the checkout page.

Under Extensions > Payments > Klarna Checkout > Settings in the admin interface, of the values I can share, please refer to the following:

Allow Separate Shipping Address - No
Date Of Birth Mandatory (UK stores only) -No
Title Mandatory (UK stores only) - No
Allow Newsletter Signup - No
Total - N/A (not set)
Terms & Conditions - 0% Interest Free Credit
Status - Enabled

Under Extensions > Payments > Klarna Checkout > Order Statuses in the admin interface, everything is set to Canceled.

Under Extensions > Payments > Klarna Checkout > Accounts in the admin interface, of the values I can share, please refer to the following:

Environment (Live/Test): Test
Country: United Kingdom
Shipping Countries: UK Shipping (the only other available value in the select dropdown is UK VAT Zone)
Currency: Pound Sterling
Locale: en-gb
API Location: Europe (North America is the only available value in the select dropdown)

I haven't added the Klarna Checkout module to the Checkout page layout, as when I did this on the staging site, it caused both the cart and checkout pages to display a white screen when I visited them with a non empty cart.

I've noticed that function getMethod() - spanning lines 57 - 60 on catalog/model/payment/klarna_checkout.php - returns an empty array, whereas on the checkout page, the only available payment method doesn't return an empty array in its getMethod function, so suspect this is causing an issue?

I also suspect that, since I didn't set a total, Klarna Checkout should work regardless of total, but I am setting the total too as I am writing this to test.

I have also set Klarna Checkout to start logging, and will see if this turns up anything new.

At the moment, I cannot see anything in either the web server error log for the staging site, nor in system/storage/logs/error.log

I hope I've provided enough information, but am more than happy to provide any further details.

Thanks in advance.
Which means that you may still avoid this issue as being the original issue since the Opencart forum does not support Journal.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Tue Oct 12, 2021 11:13 pm

arun_wirebox wrote:
Tue Oct 12, 2021 9:40 pm
There are some instructions in the comments section on https://www.opencart.com/index.php?rout ... n_id=27099 from someone called juhosyrj, I tried following them to no avail.

Also confirming that SSL is enabled for the staging site, and that I followed the extension developer's instructions on this page too.
Therefore, contact the extension developer to resolve this issue. However, since the extension is free, extension developers may prevent response to your request. Alternatively, you can always create a new service request in the Commercial Support section of the forum to get this done as a custom job.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by arun_wirebox » Wed Oct 13, 2021 8:06 pm

straightlight wrote:
Tue Oct 12, 2021 11:13 pm
arun_wirebox wrote:
Tue Oct 12, 2021 9:40 pm
There are some instructions in the comments section on https://www.opencart.com/index.php?rout ... n_id=27099 from someone called juhosyrj, I tried following them to no avail.

Also confirming that SSL is enabled for the staging site, and that I followed the extension developer's instructions on this page too.
Therefore, contact the extension developer to resolve this issue. However, since the extension is free, extension developers may prevent response to your request. Alternatively, you can always create a new service request in the Commercial Support section of the forum to get this done as a custom job.
Hi, thanks for this, I think I will raise this with them, as you never know.

If this doesn't work, I will pursue the other line of enquiry you propose.

This is going to sound stupid, but they are asking me for an order ID: if I click on the Get Support button under their contact info, this leads me to https://www.opencart.com/index.php?route=support/seller, but I can't find any orders under https://www.opencart.com/index.php?route=account/order - will I only have an order ID if I purchase an extension, i.e. are orders only for paid extensions and not free extensions?

Newbie

Posts

Joined
Wed Jul 14, 2021 6:40 pm

Post by arun_wirebox » Wed Oct 13, 2021 8:53 pm

Hi, found a convoluted way to get in touch with them, awaiting their response.

Newbie

Posts

Joined
Wed Jul 14, 2021 6:40 pm

Post by straightlight » Wed Oct 13, 2021 9:13 pm

arun_wirebox wrote:
Wed Oct 13, 2021 8:53 pm
Hi, found a convoluted way to get in touch with them, awaiting their response.
In addition, you could use the: Contact Us link at the bottom of the site.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by arun_wirebox » Wed Oct 13, 2021 9:58 pm

straightlight wrote:
Wed Oct 13, 2021 9:13 pm
arun_wirebox wrote:
Wed Oct 13, 2021 8:53 pm
Hi, found a convoluted way to get in touch with them, awaiting their response.
In addition, you could use the: Contact Us link at the bottom of the site.
Hi, I think I found what the issue is, it's a bug in their extension.

They were pointing to the wrong path for vendor/autoload.php in their vqmod XML file, which was causing issues (but strangely they weren't being logged).

Newbie

Posts

Joined
Wed Jul 14, 2021 6:40 pm

Post by arun_wirebox » Wed Oct 13, 2021 10:14 pm

In case anyone is interested, and for the sake of archival purposes, they also seem to have broken JS in the following files:

catalog/view/theme/default/template/payment/klarna_checkout.tpl
catalog/view/theme/default/template/payment/klarna_checkout_sidebar.tpl

They are calling a window._klarnaCheckout function, but it looks like the function has not been defined first - it seems that you need to load an iframe via Klarna Checkout that defines this function, and that you have to create an order through Klarna Checkout first through their REST API that provides you with the iframe you need.

Newbie

Posts

Joined
Wed Jul 14, 2021 6:40 pm

Post by straightlight » Thu Oct 14, 2021 1:55 am

arun_wirebox wrote:
Wed Oct 13, 2021 10:14 pm
In case anyone is interested, and for the sake of archival purposes, they also seem to have broken JS in the following files:

catalog/view/theme/default/template/payment/klarna_checkout.tpl
catalog/view/theme/default/template/payment/klarna_checkout_sidebar.tpl

They are calling a window._klarnaCheckout function, but it looks like the function has not been defined first - it seems that you need to load an iframe via Klarna Checkout that defines this function, and that you have to create an order through Klarna Checkout first through their REST API that provides you with the iframe you need.
Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by arun_wirebox » Thu Oct 14, 2021 4:42 am

straightlight wrote:
Thu Oct 14, 2021 1:55 am
arun_wirebox wrote:
Wed Oct 13, 2021 10:14 pm
In case anyone is interested, and for the sake of archival purposes, they also seem to have broken JS in the following files:

catalog/view/theme/default/template/payment/klarna_checkout.tpl
catalog/view/theme/default/template/payment/klarna_checkout_sidebar.tpl

They are calling a window._klarnaCheckout function, but it looks like the function has not been defined first - it seems that you need to load an iframe via Klarna Checkout that defines this function, and that you have to create an order through Klarna Checkout first through their REST API that provides you with the iframe you need.
Now that the issue has been solved, please add: [SOLVED] at the beginning of the subject line on your first post.
Hi, it wasn't fully resolved then, but I have resolved it now.

It looks like the payment controller for the Klarna Checkout extension was using the encrypt / decrypt methods on the Encryption class defined in system/library/encryption.php and was erroring because the OpenCart site (which to reiterate is 2.2.0), at least on staging (but presume on live as well) is using PHP 7.2, and the encrypt and decrypt methods are using functions that were deprecated in PHP 7.1 and removed in PHP 7.2 - the functions being mcrypt_encrypt and mcrypt_decrypt respectively.

I found an OCMOD based plugin that acts as a polyfill for these two functions - https://www.huntbee.com/opencart-fix-fo ... issue-2xxx

Having installed said plugin, I can confirm this now resolves the issue.

Newbie

Posts

Joined
Wed Jul 14, 2021 6:40 pm

Post by arun_wirebox » Thu Oct 14, 2021 6:40 am

Also created a new layout, called it Payment, and set the route value as payment/%

Everything seems to be working as expected now.

Newbie

Posts

Joined
Wed Jul 14, 2021 6:40 pm

Post by arun_wirebox » Tue Nov 23, 2021 9:48 pm

Rogahn wrote:
Fri Oct 29, 2021 12:10 pm
Make sure that test mode is switched off. Make sure that the Klarna API Credentials are entered in the correct place in your plugin. Make sure you have the correct version of Klarna's plugin installed.
Thanks, but I am not sure that the first point is relevant, as the issue was that the Klarna Checkout module could not display on checkout at all.

Whether it was test mode or not should make no difference.

Klarna API credentials were properly configured, and the correct plugin version for my version of OpenCart was installed.

I already marked this as solved anyway, so I think this comment is somewhat redundant.

Newbie

Posts

Joined
Wed Jul 14, 2021 6:40 pm

Post by tapspeed » Fri Feb 18, 2022 5:14 pm

Hello, now you can use klarna checkout for opencart 3 please check this extension:
https://www.opencart.com/index.php?rout ... n_id=43318
for full info and docs check :
https://byteblue.com/blog/klarna-payments-opencart-3/

Opencart Support | Extension Development | Opencart 3 Klarna checkout


New member

Posts

Joined
Wed Feb 02, 2022 1:09 am
Who is online

Users browsing this forum: No registered users and 15 guests