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
codestringRequiredThe code of the currency to retrieve.
configFindConfig<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.
configFindConfig<CurrencyDTO>select or relations, accept the attributes or relations associated with a currency.sharedContextContextA context used to share resources, such as transaction manager, between the application and the module.
sharedContextContextReturns
The retrieved currency.
Was this section helpful?