Skip to main content
Skip to main content

retrieveMoneyAmount - Pricing Module Reference

Beta

This 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

idstringRequired
The ID of the money amount to retrieve.
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.
sharedContextContext
A context used to share resources, such as transaction manager, between the application and the module.

Returns

PromisePromise<MoneyAmountDTO>Required
The retrieved money amount.
Was this section helpful?