Dynamics 365 Finance & Operations keeps rates per exchange rate type, and its built-in providers (OANDA, ECB, Central Bank of Russia, CBRT) each fill one type at a time. That covers accounting. Customs valuation needs a different number: the table the customs authority of the clearance country set for the declaration date. That number belongs in its own rate type, loaded from the authority's table.
This post shows three pieces: a dedicated Customs rate type, a no-code import through the Exchange rates data entity, and an automated route through a custom exchange rate provider written in X++. The rates come from the AllRatesToday customs exchange rate API; the same steps load official rates from any of the 124 central banks it covers. Full guide: allratestoday.com/docs/integrations/dynamics-365-finance/.
Step 1: a Customs exchange rate type
Exchange rate types are shared data in F&O. A type named Customs (one per clearance country if you clear in several) sits next to your default type without touching ledger revaluation.
A few properties of how F&O stores rates make this a good fit for customs tables:
- Rates are stored with a start date only. The latest rate on or before a transaction's date applies, which matches how a customs table stays in force until the next one replaces it.
- A conversion factor of 1 or 100 is set per pair.
- A reciprocal pair (EUR→USD and USD→EUR) can't both exist in one type.
That last point matters for the import below: you have to pick one direction per type and convert everything to it.
Step 2, no code: the Exchange rates data entity
Data management's Exchange rates entity (ExchangeRateEntity) imports these columns:
RateTypeName-
FromCurrency,ToCurrency -
StartDate,EndDate RateConversionFactor
Download the table, map it to those columns, and import it as a recurring data job. Getting the table is one call. Here is the Dutch customs table in force on 1 December 2026:
# The Dutch customs table in force on 1 December 2026, as CSV
curl "https://allratestoday.com/api/v1/customs/NL/2026-12-01?format=csv" \
-H "Authorization: Bearer art_live_your_key" -o customs-nl-2026-12.csv
Normalise the direction first
Customs tables come in the authority's own direction. Dutch, German and French customs quote foreign currency per 1 EUR; Japan Customs quotes yen per unit. Since F&O wants one direction per type, normalise every row to "foreign currency → home currency" before importing. This script does that and writes a CSV with the entity's column names:
import csv, requests
API = "https://allratestoday.com/api/v1/customs"
HEADERS = {"Authorization": "Bearer art_live_your_key"}
def dmf_rows(country, date, home_ccy, rate_type="Customs"):
"""Rows for the 'Exchange rates' data entity: FromCurrency -> home currency."""
t = requests.get(f"{API}/{country}/{date}", headers=HEADERS).json()
for r in t["rates"]:
if r["quote"] == home_ccy: # table quoted home per foreign
frm, rate = r["base"], r["value"]
elif r["base"] == home_ccy: # table quoted foreign per home: invert
frm, rate = r["quote"], 1 / r["value"]
else:
continue
yield {"RateTypeName": rate_type, "FromCurrency": frm, "ToCurrency": home_ccy,
"StartDate": t["rate_date"], "Rate": round(rate, 6), "ConversionFactor": 1}
with open("exchange-rates.csv", "w", newline="") as f:
w = csv.DictWriter(f, fieldnames=["RateTypeName", "FromCurrency", "ToCurrency", "StartDate", "Rate", "ConversionFactor"])
w.writeheader()
w.writerows(dmf_rows("NL", "2026-12-01", "EUR"))
StartDate is the table's rate_date, so a late or repeated run still lands on the right date. The script doesn't fill EndDate: since the latest rate on or before a transaction's date applies, the start date is what places each table in time.
Step 3, automated: a custom exchange rate provider
If you'd rather not run a data job, F&O's provider framework lets a developer add a provider class in X++. The class implements IExchangeRateProvider and extends the ExchangeRateProvider enum. Once deployed:
- it appears under General ledger > Currencies > Configure exchange rate providers, with key/value settings such as the API key and the source code;
- the Import currency exchange rates page runs it as a batch job for a chosen exchange rate type, for the current date or a date range.
Microsoft's OANDA provider (ExchangeRateProviderOanda) is the reference implementation to read alongside this. Here is a sketch of the contract, with names taken from Microsoft's documentation:
// Sketch of the provider contract (names from Microsoft's documentation).
[ExportMetadataAttribute(enumStr(ExchangeRateProvider), enumLiteralStr(ExchangeRateProvider, AllRatesToday)),
ExportAttribute('Microsoft.Dynamics.ApplicationSuite.FinancialManagement.Currency.Framework.IExchangeRateProvider')]
public class ExchangeRateProviderAllRatesToday implements IExchangeRateProvider
{
// get_Name, get_Id (a fixed GUID), set_Factory, GetSupportedOptions,
// GetConfigurationDefaults (e.g. ApiKey, Source = 'zollde' or Country = 'DE'),
// ValidateConfigurationDetail, EnumNameForLookup ...
public IExchangeRateResponse GetExchangeRates(IExchangeRateRequest _request, IExchangeRateProviderConfig _config)
{
// 1. Read the API key and source from _config.
// 2. For CurrentDate: GET /api/v1/central-bank/{source}/latest
// For DateRange: GET /api/v1/central-bank/{source}/history?from=&to=
// 3. For each pair: set_FromCurrency, set_ToCurrency, set_ExchangeRateDisplayFactor;
// for each rate: set_ValidFrom(rate_date), set_ExchangeRate(value).
}
}
The two request modes map onto two endpoints: CurrentDate to /latest, DateRange to /history?from=&to=. Each rate goes in with set_ValidFrom(rate_date), the authority's date, not the batch run date.
Schedule the batch on the authority's cadence: daily for Canada or Australia, weekly for Japan, Korea or the US, monthly for most EU customs offices. Turn on Create necessary currency pairs on the first run.
Keep the evidence
- Store the response's
rate_dateas the start date, not the day you imported. - Pairs the table didn't print come back
"derived": truewith themethod. US CBP and China customs tables are built by rule and say"method": "rule"with abasis. - History downloads (
/history, paid plans) let you rebuild a type for a past period before an audit.
Links
- Guide: https://allratestoday.com/docs/integrations/dynamics-365-finance/
- Customs exchange rate API: https://allratestoday.com/customs-exchange-rate-api/
- Covered banks and tax authorities: https://allratestoday.com/central-bank-rates-api/institutions/
- Other ERPs (Salesforce, NetSuite, Oracle Fusion, SAP, Xero, Odoo): https://allratestoday.com/docs/integrations/
- API key: https://allratestoday.com/register/
Rates are redistributed from each institution's own publication. They are reference rates for accounting, tax and compliance, not dealing quotes.
Top comments (0)