---
title: "Exchange Rates for Landed-Cost Calculators and DDP Checkout: Developer Guide"
description: "Quote duty and import tax at the customs rate the entry will actually use: one call for every destination, next-period tables, what to do when the quote and the declaration fall in different periods, caching and rounding."
canonical: https://allratestoday.com/docs/customs/landed-cost-and-ddp/
source: AllRatesToday (https://allratestoday.com/) — Markdown mirror of the page above; index of all pages at https://allratestoday.com/llms.txt
generated: 2026-11-25T14:59:28.419Z
---

# Exchange Rates for Landed-Cost Calculators and DDP Checkout: Developer Guide

Quote duty and import tax at the customs rate the entry will actually use: one call for every destination, next-period tables, what to do when the quote and the declaration fall in different periods, caching and rounding.

By [Madhushan](https://allratestoday.com/authors/madhushan/), Founder & Lead Developer · Updated 25 Nov 2026

A landed-cost quote or a DDP checkout shows the buyer duty and import tax before the goods move. The customs office will compute those amounts later, from the declaration, at the exchange rate its own rules name. Quote at a market rate and the two figures disagree: the seller absorbs the difference on DDP, or the buyer gets a bill they did not expect. This guide shows how to quote at the [official customs rate](https://allratestoday.com/customs-exchange-rate-api/) instead, for 66 destination countries.

## Why the customs rate, not a market rate

Duty is a percentage of the customs value in the importing country's currency, and import VAT or GST is then charged on the customs value plus duty. Both depend on converting the invoice at the rate the customs authority fixed for the declaration. Most authorities fix that rate for a whole period: a week in Japan and Korea, a fortnight in India, a month across most of the EU, and a day set the evening before in Canada and Australia. A quote made inside the period can use exactly the number customs will use.

## One call for every destination

A checkout that ships worldwide needs the rate for whichever country the buyer picks. `/api/v1/customs/all/latest` returns every covered country at once, converted from your pricing currency to each country's customs currency. It counts as one API call and reads from a cache, so a once-a-day refresh is enough:

```
# USD -> each destination's customs currency, every covered country, one call (paid plans)
curl "https://allratestoday.com/api/v1/customs/all/latest?source=USD" \
  -H "Authorization: Bearer art_live_your_key"
```

```
{
  "count": 66,
  "source": "USD",
  "countries": [
    { "country": "AU", "authority": "abf", "currency": "AUD", "rate_date": "...",
      "stale": false, "source": "USD", "target": "AUD", "rate": ..., "rate_type": "...",
      "derived": false, "method": "published" },
    ...
  ]
}
```

A country whose authority does not quote your pricing currency comes back with an `error` field instead of a rate. Skip it in the quote or fall back to a manual estimate; do not substitute a market rate without labelling it. On free plans, use `/api/v1/customs/{country}/latest` per country instead.

## When the quote and the clearance fall in different periods

The rate that counts is the one in force when the goods are declared, not when the order is placed. An order placed on 28 November for delivery in December clears on December's table. Three ways to handle it, in order of preference:

1. **Use the next table if it is already fixed.** EU monthly tables are set before the month starts, Canada and Australia set tomorrow's rate the evening before, China fixes next month's rate mid-month. `/api/v1/customs/{country}/next` (paid plans) returns it with `in_force_from`, or `404` while it is not set yet.
2. **Otherwise quote on the current table and say so.** Show the table date and that the amount is recalculated if clearance falls in a new period.
3. **For DDP, re-price at clearance.** Once the declaration is filed, look up the declaration date with `/api/v1/customs/{country}/{date}` and book the actual duty; the difference against the quote is your FX exposure, and it is usually small because tables move once per period.

## A quote function

```
import datetime as dt
import requests

API = "https://allratestoday.com/api/v1/customs"
HEADERS = {"Authorization": "Bearer art_live_your_key"}

def rates_for_quote(source_ccy):
    """Refresh once per day: today's customs rate for every destination."""
    body = requests.get(f"{API}/all/latest", params={"source": source_ccy},
                        headers=HEADERS, timeout=10).json()
    return {c["country"]: c for c in body["countries"] if "rate" in c}

def next_rate(country, source_ccy, target_ccy):
    """The table already fixed for the next period, or None if not set yet."""
    r = requests.get(f"{API}/{country}/next", params={"source": source_ccy, "target": target_ccy},
                     headers=HEADERS, timeout=10)
    return r.json() if r.status_code == 200 else None

def landed_cost(goods_value, freight, insurance, source_ccy, country, duty_rate, vat_rate,
                expected_clearance: dt.date, today_rates):
    today = today_rates[country]
    rate, table = today["rate"], today["rate_date"]
    # Clearance falls after the next table takes effect? Use it if it exists.
    nxt = next_rate(country, source_ccy, today["target"])
    if nxt and expected_clearance.isoformat() >= nxt["in_force_from"]:
        rate, table = nxt["rate"], nxt["rate_date"]
    # Valuation basis is the country's: e.g. the EU adds freight to the border, the US does not.
    customs_value = round((goods_value + freight + insurance) * rate, 2)
    duty = round(customs_value * duty_rate, 2)
    import_vat = round((customs_value + duty) * vat_rate, 2)
    return {"customs_value": customs_value, "duty": duty, "import_vat": import_vat,
            "currency": today["target"], "rate": rate, "table_date": table}
```

The exchange rate converts whatever amount the country's valuation rule produces. The EU includes freight and insurance to the point of entry in the customs value; the US uses the transaction value without international freight. Keep that rule per country in your duty engine; the rate step is the same for all of them.

## Caching and rounding

- **Refresh once a day.** Daily tables change once a day and the rest less often, so a morning refresh of `/all/latest` (and `/next` for the countries you ship to most) keeps every quote current.
- **Watch `stale`.** It is `true` when an authority is late with its next table. The rate is still the one in force, but flag the quote for review.
- **Round the amounts, not the rate.** Use the rate as returned and round the customs value, duty and tax to the currency's minor unit. Customs computes the same way.
- **Keep the table date with the order.** If the buyer or a marketplace disputes the import charges, the `rate_date` and authority code show which official table the quote used.

## Related guides

- [Customs filing and freight forwarding software](https://allratestoday.com/docs/customs/customs-filing-software/)
- [Export declarations: which rate applies](https://allratestoday.com/docs/customs/export-declarations/)
- [Shopify](https://allratestoday.com/docs/integrations/shopify/) for storefront prices (market rates are fine there; customs rates are for the duty line)

## Building a landed-cost or duty engine?

Tell us the destinations you price and we will confirm coverage for each.

 [Talk to us](https://allratestoday.com/contact?tab=business&topic=tax_authority_data) [Customs exchange rate API](https://allratestoday.com/customs-exchange-rate-api/)
