Skip to main content
Skip to main content

listCurrencies - Pricing Module Reference

Beta

This documentation provides a reference to the listCurrencies method. This belongs to the Pricing Module.

This method is used to retrieve a paginated list of currencies based on optional filters and configuration.

Example

To retrieve a list of currencies using their codes:

import {
initialize as initializePricingModule,
} from "@medusajs/pricing"

async function retrieveCurrencies (codes: string[]) {
const pricingService = await initializePricingModule()

const currencies = await pricingService.listCurrencies(
{
code: codes
},
)

// do something with the currencies or return them
}

To specify attributes that should be retrieved within the money amounts:

import {
initialize as initializePricingModule,
} from "@medusajs/pricing"

async function retrieveCurrencies (codes: string[]) {
const pricingService = await initializePricingModule()

const currencies = await pricingService.listCurrencies(
{
code: codes
},
{
select: ["symbol_native"]
}
)

// do something with the currencies or return them
}

By default, only the first 15 records are retrieved. You can control pagination by specifying the skip and take properties of the config parameter:

import {
initialize as initializePricingModule,
} from "@medusajs/pricing"

async function retrieveCurrencies (codes: string[], skip: number, take: number) {
const pricingService = await initializePricingModule()

const currencies = await pricingService.listCurrencies(
{
code: codes
},
{
select: ["symbol_native"],
skip,
take
}
)

// do something with the currencies or return them
}

Parameters

The filters to apply on the retrieved currencies.
The configurations determining how the currencies are retrieved. Its properties, such as select or relations, accept the attributes or relations associated with a currency.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<CurrencyDTO[]>Required
The list of currencies.
Was this section helpful?