currency query
Use the currency
query to return information about the store’s currency configuration.
Syntax
{currency {Currency}}
Example usage
The following query returns currency information for an instance of Magento that is configured for multiple currencies, USD and EUR. The default (base) currency for the store is US Dollar (USD). The response includes a list of currencies in the available_currency_codes
attribute as well as a set of exchange rates.
Request:
1
2
3
4
5
6
7
8
9
10
11
12
13
query {
currency {
base_currency_code
base_currency_symbol
default_display_currency_code
default_display_currency_symbol
available_currency_codes
exchange_rates {
currency_to
rate
}
}
}
Response:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
"data": {
"currency": {
"base_currency_code": "USD",
"base_currency_symbol": "$",
"default_display_currency_code": "USD",
"default_display_currency_symbol": "$",
"available_currency_codes": [
"EUR",
"USD"
],
"exchange_rates": [
{
"currency_to": "EUR",
"rate": 0.7067
},
{
"currency_to": "USD",
"rate": 1
}
]
}
}
}
Output attributes
The currency
object provides the following attributes:
Attribute | Data type | Description |
---|---|---|
available_currency_codes |
[String] | An array of three-letter currency codes accepted by the store, such as USD and EUR |
base_currency_code |
String | The base currency set for the store, such as USD |
base_currency_symbol |
String | The symbol for the specified base currency, such as $ |
default_display_currency_code |
String | Specifies if the currency code is set as the store’s default |
default_display_currency_symbol |
String | Specifies if the currency symbol is set as the store’s default |
exchange_rates |
[ExchangeRate] | An array of exchange rates specified in the store |
Exchange rate attributes
The ExchangeRate
object provides the following attributes:
Attribute | Data type | Description |
---|---|---|
currency_to |
String | Specifies the store’s default currency to exchange to |
rate |
Float | The exchange rate for the store’s default currency |