getCurrencyList()

Requires:
@tuya-miniapp/cloud-api≥1.3.0

Description

Get the list of currencies supported by the Energy capability. Returns all currencies currently supported by the system, excluding the DEFAULT placeholder, which can be used to render the currency selection UI.

Parameters

None

Return Value

Type: Promise<GetCurrencyListResult>
Currency list. Each item includes symbol (currency symbol, e.g., ¥, $) and code (ISO 4217 currency code, e.g., CNY, USD).

Referenced Types

typeGetCurrencyListResult`getCurrencyList` return value, list of currencies (excluding the `DEFAULT` placeholder)
CurrencyItem[]

Examples

Request example

import { getCurrencyList } from '@tuya-miniapp/cloud-api';

getCurrencyList()
  .then(result => {
    result.forEach(item => {
      console.log(`${item.symbol} (${item.code})`);
    });
  })
  .catch(error => {
    console.error('Failed to get currency list:', error);
  });

Response example

[
  { "symbol": "¥", "code": "CNY" },
  { "symbol": "$", "code": "USD" },
  { "symbol": "€", "code": "EUR" }
]

FAQ

Why does the call to cloud capabilities fail?

Before using this API, please ensure that the product to which the device belongs has enabled the Electricity Statistics advanced capability on the Tuya IoT Development Platform. Products without this capability enabled cannot collect electricity consumption/cost data, and the API will return empty data or an error. If you need to use it, please create a product with electricity consumption/cost statistics functions and enable the corresponding advanced capabilities in the product details. At the same time, the API depends on cloud capabilities, and authorization configuration is required in Development Settings - Cloud Capabilities on the Mini Program Developer Platform.