With REST API, do we load order by invoice_id and then calculate difference between order total_due and total_paid to retrieve the value equal to XML-RPC InvoiceService.calculateAmountOwed?
It is not.
<methodCall>
<methodName>InvoiceService.calculateAmountOwed</methodName>
<params>
<param>
<value><int>6287</int></value>
</param>
</params>
</methodCall>
<methodResponse><params><param><value><double>9.85</double></value></param></params></methodResponse>
GET /crm/rest/v2/orders?filter=invoice_id%3D%3D6287&page_size=1&order_by=id%20asc
"id": "6287"
"total_paid": {
"amount": 1500,
"currency_code": "USD",
"formatted_amount": "$15.00"
},
"total_due": {
"amount": 2485,
"currency_code": "USD",
"formatted_amount": "$24.85"
},
Okay, that would look to be a documentation issue then, I’ll get a ticket in to clarify it
These are the revised property documentation, which will go out with the next release:
total - The full amount of the order (the sum of all order items, including any discounts,
taxes and shipping). This value does not change as payments are made or as payment
plan installments come due. The remaining balance of the order can be calculated as total
total_paid - The sum of all payments applied to the order, regardless of whether the order
has a payment plan.
total_due - The portion of the order total that has come due, before any payments are
subtracted. This is not the current balance. Without a payment plan, this is equal to total.
With a payment plan, this is the sum of the payment plan installments whose due date has
passed (never more than total), as of the last time the order amounts were recalculated.
The amount currently owed (past due) can be calculated as total_due - total_paid.
Omitted when zero.
