In Drupal Commerce you can run into rounding errors when only using 2 significant digits, the easiest solution is to inform commerce to work with 4 significant digits
First instruct Drupal Commerce to use 4 decimals.
1 | /** |
Implement a custom formatter, so the output uses 2 decimals.
1 | /** |
Implement the hooks to alter the amount before sending it to the payment provider.
1 | /** |
If you want to do this on an existing site, you need to update all amounts
1 | /** |