Checkout REST API does not expose the `total_duties` key in its response when getting a Checkout

Hey Shopify,

Another issue again from me relating to your Checkout API using REST. This time relating to duties!

Issues

When a retailer charges duties for any of their items in the Checkout, the amount is not expose to us when calling the REST API.

Shopify’s API documentation does show that this field should get expose, but only being shown in examples:

https://shopify.dev/api/admin-rest/2022-10/resources/checkout#get-checkouts-token

(search for total_duties).

## Impact

We only know duties exist implicitly because there is a price discrepancy. i.e.

total_price != total_line_items_price + total_tax + shipping_rate.price - applied_discount.discount

We have to calculate the amount ourselves, which is trivial, until you add the complexity that total_line_items_price might include the total_tax amount within its total. Even being informed by the `

taxes_includedin theshop.json` endpoint does not reliably cover this use case.

## Example- retailer: marais-australia-1

  • checkout_token: 8db0b6d2f1e33d6518886a2a65f4eb1e
  • Checkout object (N.B. no total_duties)
{
    "total_price": "6991.09",
    "total_tax": "0.00",
    "total_line_items_price": "6400.00",
    "shipping_rate": {
        "id": "shopify-Standard%20International-50.00",
        "price": "50.00",
        "title": "Standard International"
    },
    "applied_discount": null,
}
  • Calculating duties as line_items + tax + shipping - discount != total_price
6991.09 - 6400.00 - 50.00 = 541.09

So total_duties = 541.09. Funnily enough, if you use your web checkout, that exact amount is being reported as the amount of duties to pay!

## Resolution

Can we have the total_duties amount exposed to us on all checkouts, whether any duties exist or not, please?