Custom Exchange Rate

I set the exchange rate for invoices but IN is getting the today exchange rate as a default but I want to set my own exchange rate, is this possible?

I tried to modify the exchange rate value in the Exchange Rate field int he invoice but the costs are no recalculated and If I add a new product, the exchange rate change to default

Are you using invoiceninja.com or are you self hosting the app?

For selfhosting it’s isn’t directly supported but you could set the EXCHANGE_RATES_URL in the .env file to a script or file which returns the rates you want to use encoded as JSON.

The “exchange rate” field is in the invoice form is read only, changing it won’t change the invoice.

We’ll look into supporting setting the exchange rate in our next release.

Thanks for you quick response.

Hi I’m using the selfhosting version.

Ok i will check the file that you mentioned; I saw a currencies table in the DB with exchange rate = NULL, what is the usage of it?

The table should store the latest exchange rate.

The app depends on the send-reminders cron being run to update the values.

Thanks again.

I set EXCHANGE_RATES_URL = exchangerates.json and the json file have the following format

{
“MXN”: 18.50,
“CRC”: 570
}

But when I add an item the to invoice is taking the default exchange rate, no the rates that I have in the exchangerates.json file, any idea?

Thanks

The JSON file needs to match this format: https://api.fixer.io/latest

Ok I changed the format of the json and I validate it but nothing changed in the invoice, is there any specific place where I need to save my json file? I have it in the root of my NI installation at this moment.

Regards

You can try putting it in the public folder.

Make sure to set the right value for EXCHANGE_RATES_URL

Ok I put it @ public folder and i confirm the path for the EXCHANGE_RATES_URL but the Exchange Rate shows 1.0000 now :frowning:

My client currency is Mexican Pesos and in the json I have
{
“MXN”: “18.50”
}

I clean the cache using ?clear_cache=true

FYI, after clean the cache I set the desired rate in the currencies table and now is taking the value from there. I’m not using the cron job so this would be a work around but It will better if the exchange rates files works.

I think the problem is the JSON format, it should be:

{"rates":{"AUD":1.6036,"BGN":1.9558}}

mmm I don’t know what is the issue bcs I change the json to the format that you mentioned {“rates”:{“MXN”:18.50}} and it doesn’t work either

Sorry, I’m not sure…