How to confirm correct payment capture amount through API?

Hi

I am capturing payment on fulfilment through the API.

I have a scenario where some items have been removed from an order after the authorisation was made.

If I capture the full amount there will be a balance to refund to the customer which I want to avoid.

How can I confirm the correct amount to capture through the API?

Thanks