ORDERS API: Discount calculation for gross_sales_money

I request order data from POST /v2/orders/search via the node.js SDK. We process these orders on our platform to display reporting data for customers. A field we reference often is OrderLintItem.gross_sales_price, defined as: “the amount of money made in gross sales for this line item. The amount is calculated as the sum of the variation’s total price and each modifier’s total price,” in the docs. However, if you look at order_id: Ta010GSTRnfRHb4ZQWVieO2eV you will notice that the gross_sales_price takes into consideration the total_discount_money for the. The docs don’t state that the gross_sales_price includes the total_discount_money, unless I am missing something. Furthermore, if you take a look at order_id: BmZl3RNgwEQQC4TtjJhqbixeV you will notice that here the gross_sales_price does not take total_discount_money into consideration.

Example tickets and items referenced above:

  1. order_id: Ta010GSTRnfRHb4ZQWVieO2eV
    { "id": "Ta010GSTRnfRHb4ZQWVieO2eV", "locationId": "014P7GBEC9B7X", "lineItems": [ { "uid": "efb47628-2cd6-4504-9df8-d8065efe8f79", "name": "Livvy's Nuts", "quantity": "1", "catalogObjectId": "HJI6ICUIUYUKZIO4I6KSGVO6", "catalogVersion": "1645612875270", "variationName": "Regular", "itemType": "ITEM", "appliedDiscounts": [ { "uid": "95a665a3-bcb4-4838-8b8a-ca9ee1e9370b", "discountUid": "95a665a3-bcb4-4838-8b8a-ca9ee1e9370b", "appliedMoney": { "amount": "741", "currency": "AUD" } } ], "basePriceMoney": { "amount": "800", "currency": "AUD" }, "variationTotalPriceMoney": { "amount": "800", "currency": "AUD" }, "grossSalesMoney": { "amount": "59", "currency": "AUD" }, "totalTaxMoney": { "amount": "0", "currency": "AUD" }, "totalDiscountMoney": { "amount": "741", "currency": "AUD" }, "totalMoney": { "amount": "59", "currency": "AUD" } }

  2. order_id: BmZl3RNgwEQQC4TtjJhqbixeV
    { "id": "BmZl3RNgwEQQC4TtjJhqbixeV", "locationId": "2JMZMAVSNSCTC", "lineItems": [ { "uid": "B8414BF7-3D39-49D1-A300-C9A66E80A1C2", "name": "Hamburger Sub", "quantity": "1", "catalogObjectId": "PJAY6Q4GFCGJU23CNICKXV42", "catalogVersion": "1537566520550", "variationName": "Regular", "itemType": "ITEM", "modifiers": [ { "uid": "903f8f0a-2d2b-4e03-85b3-7057cc43168c", "catalogObjectId": "TNY3YWHCKPNQTQ5RZ7BKA7EJ", "catalogVersion": "1536770890898", "name": "All The Way", "basePriceMoney": { "amount": "0", "currency": "USD" }, "totalPriceMoney": { "amount": "0", "currency": "USD" } }, { "uid": "0e43b327-2761-4f7d-866b-2bde3f792890", "catalogObjectId": "5MLUSPQ4NIMATPJ34DK4GSD2", "catalogVersion": "1536770890898", "name": "Add Cheese", "basePriceMoney": { "amount": "45", "currency": "USD" }, "totalPriceMoney": { "amount": "45", "currency": "USD" } }, { "uid": "da6bba6b-5760-411e-ace3-6d600ca1a44a", "catalogObjectId": "YVHX74MG4EXXP7ZPE5DOZJRO", "catalogVersion": "1536770890898", "name": "No Chili", "basePriceMoney": { "amount": "0", "currency": "USD" }, "totalPriceMoney": { "amount": "0", "currency": "USD" } } ], "appliedTaxes": [ { "uid": "339E9CD2-85C3-47C8-BCD6-AA175B54D0AD", "taxUid": "D0519FF5-BB57-4C96-8B56-EA3FE51B1786", "appliedMoney": { "amount": "47", "currency": "USD" } } ], "appliedDiscounts": [ { "uid": "1464A860-B93A-4433-BEC7-0CB3639FD312", "discountUid": "B0A6C8D4-59AE-47E8-A518-13CA203263F1", "appliedMoney": { "amount": "174", "currency": "USD" } } ], "basePriceMoney": { "amount": "825", "currency": "USD" }, "variationTotalPriceMoney": { "amount": "825", "currency": "USD" }, "grossSalesMoney": { "amount": "870", "currency": "USD" }, "totalTaxMoney": { "amount": "47", "currency": "USD" }, "totalDiscountMoney": { "amount": "174", "currency": "USD" }, "totalMoney": { "amount": "743", "currency": "USD" } },

:wave: Sorry about the delay. The discounts are applied differently. One is an item level discount and the other is an order level discount. Here is how item level discounts are totaled. :slightly_smiling_face:

Thank you for the information!