MoneyCents
●cart · /core·type
Integer-cents money representation used for all arithmetic inside the cart kernel. Avoids floating-point rounding by working in the currency's minor units. Convert back to via .
Properties
PROPTYPEDESCRIPTION
cents
number
currencyCode
Example
const subtotal = money.parse(line.cost.subtotal);
const tax = money.mul(subtotal, 0.1);
const formatted = money.format(tax);Related
RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter
MetadataOpen in GitHub ↗
memoryIdempotencyStore
Inmemory backed by a Map. Suitable for tests, singleprocess dev servers, and as a reference implementation. Entries lazily expire on read; there is no backgroun
Money
Decimalstring money amount paired with its currency code, matching the shape returned by most provider APIs. Pass to to convert to integer cents before doing ar