opencart / opencart

A free shopping cart system. OpenCart is an open source PHP-based online e-commerce solution.
https://www.opencart.com/
Other
7.42k stars 4.82k forks source link

Amazon Pay fatal erro #6242

Closed Schwannn closed 6 years ago

Schwannn commented 6 years ago

When I add credentials to amazon pay and click save the followings fatal error shows up: Fatal error: Call to a member function registerXPathNamespace() on boolean in /home/domain/public_html/admin/model/extension/payment/amazon_login_pay.php on line 332 Anyone knows the source of it? I am running fresh install OC 3.0.2.0

AlexChanHK commented 6 years ago

After checking and study the code, I may know the reason, do you test it the website without SSL(https)? Since the system will send a request to amazon's API to confirm the account information, but it can only get back the return value with SSL environment, curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); therefore, if you submit the setting without SSL, the system will exist error when you test in http or localhost.

Felix-Ho commented 6 years ago

@Schwannn Yes, amazon pay require SSL certificate on the store in order to use their service. (I have test it with latest version of opencart and confirm it work.) So, please apply for a SSL certificate from your hosting company and use amazon pay.

Schwannn commented 5 years ago

@AlexChanHK @Felix-Ho I left this behind for sometimes, but now I really need to get this to work, I have SSL certificate installed in my cpanel and all pages are loaded through SSL with green bar. But I still getFatal error: Call to a member function registerXPathNamespace() on boolean in /home/domain/public_html/admin/model/extension/payment/amazon_login_pay.php on line 332 when I am trying to save settings with amazon pay module.

Schwannn commented 5 years ago

This is line 332 and 333

$details_xml->registerXPathNamespace('m', 'http://mws.amazonservices.com/schema/OffAmazonPayments/2013-01-01');

$error_set = $details_xml->xpath('//m:ReasonCode');