3

Currently all Magento default imports of currency are not working for a fresh demo install of Magento 2.2.4 and a couple of my active Magento 2.2.X projects.

I've tried with Yahoo Finance Exchange, WebserviceX and Fixer.io, but all return errors:

Yahoo Finance Exchange

We can't retrieve a rate from http://query.yahooapis.com/v1/public/yql?format=json&q=select+*+from+yahoo.finance.xchange+where+pair+in+%28%22USDCHF%22%2C%22USDCNY%22%2C%22USDEUR%22%2C%22USDHRK%22%2C%22USDKMF%22%2C%22USDUSD%22)&env=store://datatables.org/alltableswithkeys for CHF.

Webservicex

We can't retrieve a rate from http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&ToCurrency=CHF.

Fixer.io

We can't retrieve a rate from http://api.fixer.io/latest?base=HRK&symbols=EUR,HRK for EUR.

I've tried testing by changing the base currency and additional currencies in Configuration -> General -> Currency setup but every time it's showing the above errors for all services.

Seems that the Fixer.io API endpoint is deprecated. And the new endpoint can't be used without a Fixer.io account. I guess Magento didn't adjust the endpoint yet...

Webservicex is returning a "Page not found" JSON response and Yahoo is returning a null value for the query.

I presume their APIs changed and Magento didn't adjust to the changes yet...

Can anyone suggest or provide a quick fix for one of the services?

EDIT After installing the shopgo module for additional currency import services you get Google Finance as a new import option.

But it returns this error:

We can't retrieve a rate from http://www.google.com/finance/converter?a=1&from=USD&to=CHF.

When using the direct link you get this error:

enter image description here

I presume it's generic since my server isn't "sending automated requests to Google Finance API".

1

If you visit that URL, you'll notice it says:

{"code":"PAGE_NOT_FOUND","message":"Page not found"} Not good. If you then go to webservicex.net and scroll through its list of API, you'll notice that none refer to currency conversion. Also, not good.

If you web search for currency import in Magento 2, you'll come to this shopgo module, which says:

Magento 2.0's default and only currency import service WebserviceX tends to go down from time to time. And sometimes, it returns empty results for some currencies.

Three times the charm: webservicex.net is probably not going to work. Try installing the module from shopgo, which uses other providers.

  • I tried installing the module, but no luck. It added Google finance and another Yahoo Finance import option, but unfortunately both of them also return an error when importing. The module was last updated 3 years ago, so no wonder it doesn't work... Thanks for try though. – Lez Jun 12 '18 at 14:13
  • Whats is the error you are getting? – Sukumar Gorai Jun 12 '18 at 14:30
  • I edited my question with the Google Finance error – Lez Jun 12 '18 at 14:47
1

Create free account : https://fixer.io

Copy your API Acces Key

Edit: [root]/vendor/magento/module-directory/Model/Currency/Import/FixerIo.php

Replace: const CURRENCY_CONVERTER_URL = 'http://api.fixer.io/latest?base={{CURRENCY_FROM}}&symbols={{CURRENCY_TO}}';

By: const CURRENCY_CONVERTER_URL = 'http://data.fixer.io/api/latest?access_key=YourAPIkey&base={{CURRENCY_FROM}}&symbols={{CURRENCY_TO}}';

With Your API key

  • +1 for this, but unfortunately the free plan of Fixer.io provides only € as the base currency, which is a problem for my stores since they use another base currency. And the basic plan of Fixer, which provides all base currencies costs 10$/month. I appreciate the answer though! – Lez Sep 29 '18 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.