retrieveCurrency - Pricing Module Reference
BetaThis documentation provides a reference to the retrieveCurrency
method. This belongs to the Pricing Module.
This method retrieves a currency by its code and and optionally based on the provided configurations.
Example
A simple example that retrieves a currency by its code:
To specify attributes that should be retrieved:
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrieveCurrency (code: string) {
const pricingService = await initializePricingModule()
const currency = await pricingService.retrieveCurrency(
code,
{
select: ["symbol_native"]
}
)
// do something with the currency or return it
}
Parameters
code
stringRequiredThe code of the currency to retrieve.
config
FindConfig<CurrencyDTO>The configurations determining how the currency is retrieved. Its properties, such as select
or relations
, accept the
attributes or relations associated with a currency.
config
FindConfig<CurrencyDTO>select
or relations
, accept the
attributes or relations associated with a currency.sharedContext
ContextA context used to share resources, such as transaction manager, between the application and the module.
sharedContext
ContextReturns
The retrieved currency.
Was this section helpful?