Introduction

 

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:

Before you begin

  • 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.

Terminology

Was this helpful?
Yes
No

Setup

To use the Currencies API, install the @wix/ecom package using npm or Yarn:

Copy
1
npm install @wix/ecom

or

Copy
1
yarn add @wix/ecom

Then import { currencies } from @wix/ecom:

Copy
1
import { currencies } from '@wix/ecom'
Was this helpful?
Yes
No

convertCurrency( )

Returns an array of amounts converted from the original (from) currency to the target (to) currency and the timestamp for the conversion rate used.

Use the convertCurrency() function to convert an array of one or more amounts between two currencies. The convertCurrency() function returns an array of converted amounts and the timestamp for the conversion rate used.

Note: The currency codes used must exist in the array of supported currencies returned by the listCurrencies() function.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Currencies
Manage Stores - all permissions
Learn more about permission scopes.
Copy
function convertCurrency(identifiers: ConvertCurrencyIdentifiers, amounts: Array<DecimalValue>): Promise<ConvertCurrencyResponse>
Method Parameters
identifiersConvertCurrencyIdentifiersRequired

Identifying details needed to determine which currency rate to convert. The combination of the from and to properties together comprise the unique ID.


amountsArray<DecimalValue>Required

Amounts to convert.

Returns
Return Type:Promise<ConvertCurrencyResponse>
Was this helpful?
Yes
No

getConversionRate( )

Returns the conversion rate between 2 currencies.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Currencies
Manage Stores - all permissions
Learn more about permission scopes.
Copy
function getConversionRate(identifiers: GetConversionRateIdentifiers): Promise<ConversionRateResponse>
Method Parameters
identifiersGetConversionRateIdentifiersRequired

Identifying details needed to get the conversion rate. The combination of the from and to properties together comprise the unique ID.

Returns
Return Type:Promise<ConversionRateResponse>
Was this helpful?
Yes
No

listCurrencies( )

Returns an array of currencies. The array lists all currencies for which Wix supports conversion and their symbols.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Currencies
Manage Stores - all permissions
Learn more about permission scopes.
Copy
function listCurrencies(): Promise<ListCurrenciesResponse>
Request
This method does not take any parameters
Returns
Return Type:Promise<ListCurrenciesResponse>
Was this helpful?
Yes
No