retrieveMoneyAmount - Pricing Module Reference
BetaThis documentation provides a reference to the retrieveMoneyAmount
method. This belongs to the Pricing Module.
This method retrieves a money amount by its ID.
Example
To retrieve a money amount by its ID:
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrieveMoneyAmount (moneyAmountId: string) {
const pricingService = await initializePricingModule()
const moneyAmount = await pricingService.retrieveMoneyAmount(
moneyAmountId,
)
// do something with the money amount or return it
}
To retrieve relations along with the money amount:
import {
initialize as initializePricingModule,
} from "@medusajs/pricing"
async function retrieveMoneyAmount (moneyAmountId: string) {
const pricingService = await initializePricingModule()
const moneyAmount = await pricingService.retrieveMoneyAmount(
moneyAmountId,
{
relations: ["currency"]
}
)
// do something with the money amount or return it
}
Parameters
id
stringRequiredThe ID of the money amount to retrieve.
config
FindConfig<MoneyAmountDTO>The configurations determining how a money amount is retrieved. Its properties, such as select
or relations
, accept the
attributes or relations associated with a money amount.
config
FindConfig<MoneyAmountDTO>select
or relations
, accept the
attributes or relations associated with a money amount.sharedContext
ContextA context used to share resources, such as transaction manager, between the application and the module.
sharedContext
ContextReturns
The retrieved money amount.
Was this section helpful?