Download exchange rates from your source – with one link
Do you have your own website or accounting software, CMS Opencart, WooCommenrce, Prestashop, Magento, or another system that already stores the "correct" exchange rates? The ones you actually use to calculate prices—not the exchange rates, but your own. Previously, you had to manually import them into Elbuz. Not anymore. You place a small script on your website that displays the rates in a simple format, link to it in Elbuz, and the system automatically fetches the latest rates and recalculates the prices.
Once you've set up the link, Elbuz will automatically take rates from your source, just like from an official bank.
Why is this necessary and what problem does it solve?
Elbuz can pull rates from public sources like exchanges and central banks. But in real business, the "bank" rate and the rate you sell at are often different. different numbers You may have:
- your internal course, which is established by the accounting department or manager;
- rate from your main system (website on Magento, OpenCart, 1C, custom CRM), where it is already defined and used in all calculations;
- rate with a markup "bank + 0.5", at which you purchase currency from the supplier.
The main purpose of this function is make Elbuz calculate prices at the same rates as your main system To avoid discrepancies anywhere: the figures on the website, in accounting, and in Elbuz match exactly.
What you get in the end:
- the only source of truth for the courses is yours;
- automatic update without manual input and without “forgot to fix” errors;
- Instant recalculation of prices in price lists as soon as the exchange rate changes.
How it works in simple terms
Imagine a question-answer exchange:
- There's a small page (script) on your website. When accessed via a link, it displays the current exchange rates as text in the format JSON.
- In Elbuz settings you select the source Custom JSON URL and insert a link to this page.
- When you update, Elbuz opens your link, reads the response, recalculates the exchange rates relative to its base currency, and saves them.
In other words, your website acts as the "course provider," and Elbuz is the "receiver." All you need to do is provide the data in a user-friendly format. More on that below.
File format: What Elbuz expects to receive from the link
At the specified link, your site should return text in JSON format with strictly defined structure Here's a minimal example of what should come in response:
{ "base": "USD", "date": "2026-04-28 14:15:00", "source": "magento_1.9", "source_url": "https://moysite.com", "rates":{ "USD": 1.0, "UAH": 43.80000000, "EUR": 0.92000000 } }Description of fields
| Field | Mandatory | What does it mean? |
|---|---|---|
| base | Yes | The base currency of your source is the one against which all rates are calculated. In the example, this is USD. It is written as a three-letter code (USD, EUR, UAH, PLN…). |
| rates | Yes | List of exchange rates. These are currency code → number pairs. The number is how many units of a given currency are equal to one unit of the base currency (see details below). |
| date | No | The date and time at which the rates are current. This is for informational and convenient purposes only and does not affect calculations. |
| source | No | The name of your source (eg. magento_1.9 or 1c ). Explanatory field. |
| source_url | No | Source website address. Explanatory field. |
The most important rule about "rates"
This is the place where mistakes are most often made, so we will look at it separately. The number in rates reads like this:
1 unit of base currency = the specified number of units of that currency.
In our example base — this is USD, and in rates written "UAH": 43.8. This means: 1 dollar = 43.8 hryvnias. AND EUR: 0.92 Means: 1 dollar = 0.92 euros.
The base currency itself is always equal to one: "USD": 1.0 This is correct and necessary - leave it on the list.
Clue: If you're exporting data from Magento, OpenCart, or 1C, the exchange rates are stored using exactly this logic—from the base currency to the target currency. Therefore, the format is matched naturally, and there's no need to calculate anything manually.
How Elbuz recalculates exchange rates for its own purposes
You have your own in Elbuz base currency (the one marked "default"). It can not match with your source's base currency—and that's fine. Elbuz can convert using a so-called cross rate.
The logic is simple and safe:
- Elbuz takes from your response the exchange rate of its base currency and the exchange rates of all other currencies that it has registered and enabled.
- Recalculates them relative to each other to obtain rates specifically to its base currency.
- The base currency of Elbuz always remains equal to 1.
The only strict condition: in your answer in the blockratesThe Elbuz base currency must be present. If it's not there, there's nothing to recalculate the exchange rates from, and the update won't work. For example, if the Elbuz base currency is the hryvnia (UAH), thenratesmust contain a line"UAH":....
Practical conclusion: turn on rates all currencies you use in Elbuz, and definitely the Elbuz base currency. Extra currencies won't hurt: those not in your Elbuz currency list are simply ignored.
The comparison is based on the currency code (for example, USD ). If a currency in Elbuz has an additional code (the "second code" field), Elbuz will try to find the exchange rate using it as well—this helps with minor discrepancies in the notations.
Step-by-step setup
Step 1: Place the download script on your website
You need a page on your website that displays courses in the format above. If you're using Magento 1.9, you can use the ready-made example (see the section below) with virtually no changes. For other systems, the script is written in a similar way: the main thing is that the output is JSON with the fields. base And rates.
We recommend protecting the page with a simple token key to prevent anyone from requesting courses. In this example, this is the parameter ?key=YOUR_TOKEN.
Step 2: Check the link in your browser
Open your link in a regular browser, for example:
https://moysite.com/etrade_http_tunnel2/currency_rates_magento19.php?key=ВАШ_ТОКЕНYou should see the same JSON with the rates on the screen. If you see it, half the job is done. If you see an error or a blank page, first fix the script before moving on.
Step 3: Select a source in Elbuz
- Open the section Currencies (list of currencies).
- Find the field Source of Courses.
- Select an option "Custom JSON URL (standard format)".
- A field will appear Custom JSON URL - paste your entire link into it (along with the token)
?key=...).
The setting is saved automatically; you don’t need to press a separate button.
Step 4: Run the update and check the results
Run the rate update. Elbuz will access your link, read the rates, and update the currency values. Afterwards, check that the rates in the currency list match the expected ones.
Advice: Course updates are usually set to run regularly and automatically (on a schedule). Then Elbuz will automatically visit your link, for example, once a day, and keep the courses up-to-date without your intervention.
A ready-made example: downloading courses from Magento 1.9
Below is a working example of a script that reads courses directly from the Magento 1.9 database and delivers them in the required format. Place the file in a folder on your website (for example, etrade_http_tunnel2/ in the Magento root) and access it via the link with the token.
/etrade_http_tunnel2/) $magento_root = dirname(__DIR__); $local_xml_path = $magento_root. '/app/etc/local.xml'; header('Content-Type: application/json; charset=utf-8'); // Checking the token $provided_token = isset($_GET['key'])? (string)$_GET['key']: ''; if (!hash_equals($access_token, $provided_token)) { http_response_code(403); echo json_encode(['error' => 'forbidden']); exit; } // Read Magento database settings from local.xml $xml = simplexml_load_file($local_xml_path); $conn = $xml->global->resources->default_setup->connection; $tbl_prefix = (string)$xml->global->resources->db->table_prefix; $pdo = new PDO( 'mysql:host='. (string)$conn->host. ';dbname='. (string)$conn->dbname. ';charset=utf8', (string)$conn->username, (string)$conn->password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC] ); // Magento base currency $stmt = $pdo->prepare("SELECT value FROM {$tbl_prefix}core_config_data WHERE path = 'currency/options/base' AND scope = 'default' AND scope_id = 0 LIMIT 1"); $stmt->execute(); $base = $stmt->fetchColumn(); // Rates: from the base currency to all configured ones $stmt = $pdo->prepare("SELECT currency_to, rate FROM {$tbl_prefix}directory_currency_rate WHERE currency_from =:base AND rate > 0"); $stmt->execute([':base' => $base]); $rates = [(string)$base => 1.0]; // base currency always = 1 foreach ($stmt->fetchAll() as $row) { $rates[$row['currency_to']] = (float)$row['rate']; } echo json_encode([ 'base' => (string)$base, 'date' => date('Ymd H:i:s'), 'source' => 'magento_1.9', 'rates' => $rates, ], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); If you don't have Magento, but another system, use this example as a template: connect to your database or API, get the courses, and collect the same array with fields. base And rates The structure of the answer must remain exactly the same.
Recommendations for filling out
- Always include the Elbuz base currency in
rates. Without it, recalculation is impossible and the update will not take place. - Leave the source base currency at 1.0. This is the "starting point" for all other courses.
- Use standard three-letter codes (USD, EUR, UAH, PLN, GBP). They must match the currency codes entered in Elbuz.
- Please provide sufficient decimal places. Courses like
0.92000000more accurate than rounded to two decimal places - especially for expensive goods. - Protect the link with a token. Courses are commercial information, do not leave the page open to everyone.
- First check in the browser, then connect. If the link shows valid JSON, then Elbuz will read it too.
- Include only the currencies you need in the list. Elbuz will ignore any extra ones, but there's no point in cluttering the response with dozens of unused currencies.
Frequently asked questions and troubleshooting
| Symptom | Probable cause and solution |
|---|---|
| The courses haven't been updated at all. | Check the link in your browser. If the page is unavailable, returns an error, or is empty, the problem is with your script. Also, make sure the entire link, including the token, is pasted. |
| A "forbidden" (403) error is visible. | The token doesn't match. Check that ?key= in the link is equal to the token in the script. |
| The update has "passed", but the rates have not changed. | Most likely, in rates There is no Elbuz base currency, or the currency codes in the response do not match the codes in Elbuz. Check the symbols (USD, UAH, etc.). |
| The rates are "inverted" (for example, instead of 43.8, it turned out to be 0.022) | The rule was broken rates: The number should mean "1 base currency = N of this currency," not the other way around. Check the download logic. |
| The response does not come in JSON. | Make sure the script returns the header Content-Type: application/json and the response does not contain any extra text, PHP warnings, or HTML before/after the JSON. |
Briefly about the main thing
This feature turns any of your websites or systems into personal source of exchange rates For Elbuz, you deploy a simple script once that returns JSON with fields base And rates, paste the link into the "Custom JSON URL" setting, and Elbuz starts calculating prices exactly according to your rates, updating them automatically. No manual input, no discrepancies between systems.

