Integration with YNAB, formats amount to milliunits

Hi, we are trying to make an integration with YNAB.
We need to sync transactions from YNAB to another app, and then update it in YNAB (mark that it has been synced)
We are receiving amount of transaction from YNAB, updating in another app and when we are trying to update it again in YNAB - getting an error [400] bad_request amount must be an integer.
In order to update transaction in YNAB we are making API call, the problem that YNAB using some different format:
" The API only allows integers but we use a format called milliunits which allows you to specify a decimal value. For example, to specify 11.32 you would use 11320"

So we are receiving from YNAB:
Date July 28, 2024 12:00 AM

  • Amount -153.7
    And in order to update it again in YNAB we need to format -153.7 to 153700

How we can do this?

Simply multiply the number by 1000.

e.g.:

{{ 11.32 * 1000 }}

Hope this helps! Let me know if there are any further questions or issues.

You can also join us in the Make Fans Discord server to chat with other makers. Due to the evolving needs of this community, the Discord invite link can be found elsewhere on this forum. You can either search for it or message me to request an invite.

It works, thank you!