I’m working on a project where I need to fetch Gross Sales and Net Sales data with 100% accuracy as a developer.
Right now, I know I can use the Admin API (REST/GraphQL) to fetch order data and calculate sales, discounts, returns, and taxes on my side. But I’ve also read that sometimes this method may not always give real-time or fully accurate data (for example, when handling refunds, adjustments, or cancellations).
My question is: What’s the best practice or recommended approach to get fully accurate Gross Sales and Net Sales numbers directly from Shopify? Is there an API or report endpoint that guarantees 100% accurate data, or do developers usually need to build their own calculation logic from order data?
If anyone has experience or examples of how you’ve solved this, it would be really helpful.
The sum of the prices for all line items after discounts and before returns, in shop and presentment currencies. If taxesIncluded is true , then the subtotal also includes tax.
You can also use the agreements connection if you need to validate the corresponding sales records.
Hi @KyleG-Shopify, any tips for replicating the net/gross sales view over time, shown in Shopify Analytics?
I’ve been building out my analytics app, retailQ, and found its very hard to use the API for:
removing gift cards (not counted in analytics), but are included in the totalPriceSet/currentTotalPriceSet
splitting refunds into gift card, non-gift card, and shipping (I’m using the refund lines, but felt there should be better way!)
partial refunds also seem to completely remove tax and adjust the order instead leading to some strange edge cases (with gross sales of $100, tax of $10, and a refund of $1, net sales will appear as $109)
I’ve managed to find workarounds for these, but it felt more complicated than it should be, so wanted to check!
Can you share a little more context on a specific order scenario where you’re unable to get things to match?
Specifically the steps I can take to replicate the inconsistency you see so I can then work back to find a way to get this to match (if possible) using the refund object.