Currently using the Multi-Currency Module on v22.0.4 with currencylayer API, and when testing the default API endpoint URL, I was getting auth errors and unable to proceed with my CRON job running as normal.
error: { "success": false, "error": { "code": 101, "type": "invalid_access_key", "info": "You have not supplied a valid API Access Key. [Technical Support:support@apilayer.com]"}}
The fix was simple, change the URL endpoint to use CurrencyLayers new endpoint which can be set on the /admin/multicurrency.php page:
Old:
https://api.currencylayer.com/live?access_key=__MULTICURRENCY_APP_KEY__&source=__MULTICURRENCY_APP_SOURCE__
New:
https://api.apilayer.com/currency_data/live?base=__MULTICURRENCY_APP_SOURCE__
I believe this may be addressed in v23 but I figured I would document the fix for anyone else running into this error.
With the above change made, the manual sync and cron sync of currencies in the multi-currency module is re-enabled.
Hey Zachmelo!
Thanks for sharing this fix, that’s really helpful for the community. You’re absolutely right that CurrencyLayer migrated to the new apilayer.com domain and changed their endpoint structure. This has been catching quite a few people off guard.
The authentication error you encountered is exactly what happens when the old API endpoint tries to validate keys against the legacy system. Your solution to update the endpoint URL in admin/multicurrency.php is spot on. The new endpoint structure with api.apilayer.com/currency_data/live and the base parameter instead of source aligns with their current API specification.
I think you’re right that this should be addressed in v23, but it’s worth checking the GitHub repository to see if there’s already an issue filed for this. If not, might be worth creating one so the core team can update the default endpoint for future releases.
For anyone else hitting this issue, the multicurrency configuration is under Setup > Modules/Applications > Multi-Currency, then you can modify the API endpoint URL as Zachmelo described. Make sure to test the manual sync first before relying on the cron job.
Good catch on documenting this here, saves others from scratching their heads over the authentication errors.
Clément Houde - Founder of Dolicraft
1 Like