Admin API GraphQL: how to get correct prices for discounted order

I am building an integration between Shopify and our ERP via the admin API using GraphQL. All is working well except when I try and get the exact prices for an order.

In the documentation discountedTotalSet should be ‘The total line price after discounts are applied’ but I am finding it returns the full price - see examples below.

Can anyone give me guidance on how to get the API to show the same prices that are on the order? I need this to match exactly line by line.

This is the query I am using for the order:

{
  node(id: "gid://shopify/Order/4866288156908") {
    id
    ...on Order {
      name
      lineItems (first: 50) {
        edges {
          node {
            id
            quantity
            sku
            discountedTotalSet {
              shopMoney {
                currencyCode
                amount
              }
            }
          }
        }
      }
    }
  }
}

And this is the result, note amount says 599.00 but that is not correct, see screenshot for the same order from the UI.

{
  "data": {
    "node": {
      "id": "gid://shopify/Order/4866288156908",
      "name": "AK-1003",
      "lineItems": {
        "edges": [
          {
            "node": {
              "id": "gid://shopify/LineItem/12356850286828",
              "quantity": 1,
              "sku": "AK-A1081",
              "discountedTotalSet": {
                "shopMoney": {
                  "currencyCode": "AUD",
                  "amount": "599.0"
                }
              }
            }
          }
        ]
      }
    }
  },

Anyone got any tips for me on this one? I can’t get the admin API to return the correct price for a discounted order.

Bump. Anyone know the answer to this? It must be possible to get the correct price for an order via the API, right? This is driving me nuts!

OK, found a possible solution to this with help from Stack Overflow. Will test out and update here.