Convert an amount
Calculate the equivalent of a foreign-currency amount in Dominican pesos.
Convert an amount
amount is expressed in foreign currency, with up to two decimal places. amountDop is a string with two decimal places. The operation is from the user’s perspective: sell to sell foreign currency; buy to buy it.
const response = await fetch(
'https://api.divisa.do/v1/convert?currency=USD&amount=100&operation=sell&fields=amountDop,rate,currency,operation,feesIncluded',
{ headers: { Accept: 'application/json' } }
);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const { data, meta } = await response.json();
console.log(data);Choose an institution
Without institution, the API uses the best current commercial rates. Add institution and channel to narrow the selection. Unpublished fees are excluded.
curl --fail-with-body 'https://api.divisa.do/v1/convert?currency=USD&amount=100&operation=buy&institution=popular&channel=digital' \
-H 'Accept: application/json'Handle an unavailable rate
A partial quote supports only its available side. If no rate is eligible, do not calculate with zero or treat an official reference as a commercial offer. Always check the HTTP status and the result.