The Currencies API is used to convert from one currency to another and get exchange rates.
Currency rates are provided by XE and are updated on a daily basis. Rates are provided together with the timestamp when they were set. By using the Currencies API you agree to XE's Terms of Use.
The Currencies API provides these functions:
listCurrencies()
to get a list of all the convertible currencies.convertCurrency()
to convert amounts between two currencies.getConversionRate()
to get today’s conversion rate for a pair of currencies.To use the Currencies API you must upgrade your site to a Premium Plan.
The currency converter changes the displayed prices on your site for different currencies but does not change the payment currency. The payment is always made in the currency set in your site's Dashboard.
The currency codes used must exist in the array of supported currencies returned by the listCurrencies()
function.
To use the Currencies API, import { currencies }
from the wix-ecom.v2
module:
The API can be used, for example, with the currency conversion dropdown element on your Wix Stores page to display prices in a range of different currencies. Selecting a different currency from the dropdown on a Wix Stores page automatically updates all of the prices displayed on your store's page to the selected currency. While the currency converter dropdown works with your Wix Stores pages, the Currencies API can be used on any page.
The following functions in Currencies are restricted and only run if you elevate permissions using the wix-auth
elevate()
function:
Warning: Elevating a function allows it to be called by any site visitor. Exercise caution to prevent security vulnerabilities.