Storing and Send

When storing and sending monetary amounts you need to ensure that you retain the precision and scale of the amount.

The best way to do this is to store the amount is three components.

  • Minor units

  • Scale

  • Currency Code

A value of $AUD1.99 would be stored as:

Minor Units: 199

Scale: 2

Currency Code: AUD

Using this technique guarantees you will always get back the amount you stored or transmitted.

If you are only using a single currency the Fixed package provides tools to store the minor unites and scale.

Last updated