With some encouragement from @Schultzer, ex_money version 1.1.3 now makes it easier to work with money in integer form to help easy integration with API’s that use that form like Stripe.
iex> m = Money.new(:USD, 200.012356)
#Money<:USD, 200.012356>
# Return the money amount as {currency, integer, exponent, remainder}
iex> Money.to_integer_exp(m)
{:USD, 20001, -2, #Money<:USD, 0.002356>}
# Convert from integer to money. ex_money will look up
# how many implied decimal places are intended based
# upon the currency definition in CLDR
iex> Money.from_integer(20000, :USD)
#Money<:USD, 200.00>
iex> Money.from_integer(20000, :JPY)
#Money<:JPY, 20000>
Hopefully this makes it easier to work with other libraries that use the integer format even though the risk of miscalculating the exponent for the appropriate currency is still a risk with this representation.






















