So based on this, it doesn’t look like you’re filtering by a particular status, so this is touching on my earlier point: with this query, you’ll get all orders regardless of status (OPEN, CANCELED, COMPLETED). OPEN and especially CANCELED may not have payments associated with them, so you wouldn’t want to consider those in gross sales, since you didn’t actually sell anything.
You probably want to look for:
-
COMPLETEDorders are for sure paid for, so go ahead and add them up -
OPENorders may be paid for (depending on if you have fulfillments and how you’re updating them). So, you probably want to check fortenderswithin the order object and see if there’s a payment. -
CANCELEDshould be ignored since no payment occurred. - You would also (in the future) want to check for if it’s a refund, and handle that accordingly
Let me know if that still doesn’t help though