Hi,
We sync customer’s sales data (from the Orders API) with our product and have been for many years now, not able to really have an accurate calculation of total sales processed for any given day, mostly due to calculation of refunds being inconsistent.
There seems to be potentially two methods of calculating refunds:
- use the order.refunds.transactions array and calculate the refund amount from amount.
- use order.refunds.refund_line_items and loop through subtotal + total_tax.
Our customer has given us a spreadsheet of their sales exported from their shopify dashboard to help us compare what we get from the Orders API and discern how the total sales is calculated. In cases where order.refund.transactions is an empty array, I am seeing that if I calculate via order.refunds.refund_line_items, I am seeing the total sales number match from the customer’s sales export. This is not how I was told to calculate refunds. Can someone please finally clarify how this should be done?
In one case, order.refund.transactions amount is a lesser number than order.refunds.refund_line_items, but the shopify sales report will show the larger number. This seems to suggest that order.refunds.refund_line_items takes precedent?