Web Scraper worked but now does not

I built a web scraper to pull daily sales information/per location as the data was not readily available via API. After working for a few months, there is now a captcha at the login…why…Can an API be added to pull the daily sales by location?

:wave: With the Payments API and the Order API you can pull all sales data for each of your locations. :slightly_smiling_face:

Bryan, that is a very Generic answer to a very specific question of pulling daily sales stats. I posted the question after I had already reviewed the API references and have tried to create a python script that emulates what was being done in the web scraper that was broken by the change made with the captcha. There is nothing that has all of the sales data for day as in on the actual webpage when logging into the application.

1 Like

At this time there isn’t an API that returns the sales data that you see when logging into the Seller Dashboard. It’s a combination of the the Payments API and the Order API. With the results from these APIs the sales data is calculated.

Bryan
Has this changed? The reason I ask is because when I am looking at the order detail now, it shows information for sales for each item.
Also…the amount appears to be a whole number without decimal places.

To calculate gross sales like in the summary report would the calculation be:

‘gross_sales_money’: {‘amount’: 295, ‘currency’: ‘USD’} minus ‘total_discount_money’: {‘amount’: 0, ‘currency’: ‘USD’} and ‘return_amounts’: {‘discount_money’: {‘amount’: 0, ‘currency’: ‘USD’},
‘service_charge_money’: {‘amount’: 0, ‘currency’: ‘USD’},
‘tax_money’: {‘amount’: 0, ‘currency’: ‘USD’},
‘tip_money’: {‘amount’: 0, ‘currency’: ‘USD’},
‘total_money’: {‘amount’: 0, ‘currency’: ‘USD’}}

Not sure I understand what difference you are seeing with the Orders API? Our APIs have always retuned the amount in whole numbers. With Square’s APIs, the amount field is always in the smallest denomination of the currency indicated by currency_code. When currency_code is USD (US dollars), the amount will reflect in cents. For example, an object priced at $5.00 will be inputted as 500 in the amount field.

The gross sales in the Sales Summary is the total amount of all the items before any discounts or taxes are calculated.

So…I guess I will ask this question again. How do I calculate the gross sales that shows in the summary report?

There are a multitude of data in the json query, so knowing the specific field names is critical to understanding how to calculate the exact response needed. As an example for one of the stores, the value is $2,818.95 on the summary report but based upon the responses, I have not been able to calculate and come to the same number.

Here is an example of one item.
[{“id”: “bnkjuv6LSFsmc956zEcUlWneV”,“location_id”: “HKGZHW2S5S8RF”,“line_items”:
[{“uid”: “8E88E07B-9B17-44F9-A0DA-24AD92FEE641”,
“catalog_object_id”: “4G2VAK4J3MFYO7XZKBQY7U5B”,
“catalog_version”: 1589303597459,
“quantity”: “1”,
“name”: “Flav Bl T3”,
“variation_name”: “”,
“base_price_money”: {“amount”: 520,“currency”: “USD”},
“gross_sales_money”: {“amount”: 520,“currency”: “USD”},
“total_tax_money”: {“amount”: 49,“currency”: “USD”},
“total_discount_money”: {“amount”: 0,“currency”: “USD”},
“total_money”: {“amount”: 569,“currency”: “USD”},
“variation_total_price_money”: {“amount”: 520,“currency”: “USD”},
“applied_taxes”: [{“uid”: “0AE936A2-CE51-49C0-A395-317C55912D3E”,
“tax_uid”: “52A04DFE-3272-4742-BF9E-F7D6258D13F3”,
“applied_money”: {“amount”: 49,“currency”: “USD”}}]

1 Like

I would also like to know an answer to this. If we can’t build an api to get the specific data we want and we can’t build a webscraper, then our options are only tedious

What are you having trouble calculating with orders returned by the API? Gross sales are the overall product sales in a period, including modifiers. This amount is not adjusted for refunds or discounts, and doesn’t include taxes and tips collected on a sale. Gross sales exclude the sale of a physical gift cards from Square, but include the sale of products tendered with your gift cards. :slightly_smiling_face: