This workflow corresponds to n8n.io template #6358 — we link there as the canonical source.
This workflow follows the Execute Workflow Trigger → HTTP Request recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"nodes": [
{
"id": "7190490e-26f7-49f9-9e18-dd2770752d2d",
"name": "Get Square Locations",
"type": "n8n-nodes-base.httpRequest",
"position": [
-40,
-60
],
"parameters": {
"url": "https://connect.squareup.com/v2/locations",
"options": {},
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "ae8f1a30-f38b-469f-8cdb-4499fdd33a9c",
"name": "Turn Locations Into List",
"type": "n8n-nodes-base.splitOut",
"position": [
180,
-60
],
"parameters": {
"include": "selectedOtherFields",
"options": {},
"fieldToSplitOut": "locations",
"fieldsToInclude": "id"
},
"typeVersion": 1
},
{
"id": "80091b42-8c69-4a06-8d0d-8787246660b2",
"name": "Ignore Locations w/o Sales",
"type": "n8n-nodes-base.if",
"position": [
680,
-60
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "498f5fab-6930-4e89-9fbe-0d67671da8d2",
"operator": {
"type": "array",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.orders }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "2f61bfb7-365a-48d7-b23c-d545571ed0a2",
"name": "Get Sales from Square",
"type": "n8n-nodes-base.httpRequest",
"position": [
440,
-60
],
"parameters": {
"url": "https://connect.squareup.com/v2/orders/search",
"method": "POST",
"options": {},
"jsonBody": "={\n \"location_ids\": [\"{{ $json.locations.id }}\"],\n \"query\": {\n \"filter\": {\n \"state_filter\": {\n \"states\": [\"COMPLETED\"]\n },\n \"date_time_filter\": {\n \"created_at\": {\n \"start_at\": \"{{ $('When Executed by Another Workflow').item.json.report_date }}T00:00:00-05:00\",\n \"end_at\": \"{{ $('When Executed by Another Workflow').item.json.report_date }}T23:59:59-05:00\"\n }\n }\n }\n },\n \"limit\": 1000,\n \"return_entries\": false\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "ecca8b73-5e3a-4a96-a8a3-2c57afae7991",
"name": "When Executed by Another Workflow",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"notes": "Supply a report date in the following format: (YYYY-MM-DD)\nExample (2025-07-23)",
"position": [
-300,
-60
],
"parameters": {
"workflowInputs": {
"values": [
{
"name": "report_date"
}
]
}
},
"notesInFlow": false,
"typeVersion": 1.1
},
{
"id": "bd38c6f7-92cd-46c9-b663-4aa77574fb5a",
"name": "Compile Sales Reports",
"type": "n8n-nodes-base.code",
"position": [
960,
-60
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Date and Location Metadata\nconst date = $('When Executed by Another Workflow').item.json.report_date;\nconst location_id = $json.orders[0].location_id || null;\nconst location_name = $('Get Square Locations').item.json.locations.find(locations => locations.id === location_id)?.name;\n\n// Our Result Variables\nlet total_money = 0;\nlet total_tax = 0;\nlet total_discount = 0;\nlet total_tip = 0;\nlet total_returns = 0;\nlet cash_rounding = 0;\n\nlet cash_tender = 0;\nlet card_tender = 0;\nlet gift_card_tender = 0;\nlet other_tender = 0;\nlet fees = 0;\n\n// Loop Through Each Order\nfor (const sale of $json.orders) {\n\n // Add the sales, taxes, discounts and tips\n total_money += sale.total_money?.amount || 0;\n total_tax += sale.total_tax_money?.amount || 0;\n total_discount += -(sale.total_discount_money?.amount || 0);\n total_tip += sale.total_tip_money?.amount || 0;\n if (sale.rounding_adjustment) {\n cash_rounding += sale.rounding_adjustment.amount_money?.amount || 0;\n }\n\n \n if (sale.return_amounts) {\n // If there are returns, subtract from sales totals and add to return amount total\n total_money -= sale.return_amounts?.total_money?.amount || 0;\n total_tax -= sale.return_amounts?.tax_money?.amount || 0;\n total_discount -= sale.return_amounts?.discount_money?.amount || 0;\n total_tip -= sale.return_amounts?.tip_money?.amount || 0;\n \n total_returns += -(sale.return_amounts?.total_money?.amount || 0);\n total_returns -= -(sale.return_amounts?.tax_money?.amount || 0);\n total_returns -= -(sale.return_amounts?.tip_money?.amount || 0);\n total_returns -= -(sale.return_amounts?.discount_money?.amount || 0);\n \n // If an array of refunds is provided\n for (const refund of sale.refunds || []) {\n const transaction_id = refund.transaction_id;\n \n // Look for the original sale this refund refers to\n const original_sale = $json.orders.find(original =>\n original.id && transaction_id && original.id.includes(transaction_id)\n );\n \n if (original_sale) {\n if (original_sale.rounding_adjustment) {\n const amount = original_sale.rounding_adjustment.amount_money?.amount || 0;\n cash_rounding -= amount;\n total_returns += amount;\n }\n \n if (original_sale.tenders) {\n for (const tender of original_sale.tenders) {\n if (tender.id === refund.tender_id) {\n const amount = refund.amount_money?.amount || 0;\n if (tender.type === 'CARD') card_tender -= amount;\n else if (tender.type === 'CASH') cash_tender -= amount;\n else if (tender.type === 'SQUARE_GIFT_CARD') gift_card_tender -= amount;\n else other_tender -= amount;\n \n if (refund.processing_fee_money && tender.id === refund.tender_id) {\n fees -= refund.processing_fee_money.amount || 0;\n }\n }\n }\n }\n }\n }\n }\n \n if (sale.tenders) {\n for (const tender of sale.tenders) {\n const amount = tender.amount_money?.amount || 0;\n if (tender.type === 'CARD') card_tender += amount;\n else if (tender.type === 'CASH') cash_tender += amount;\n else if (tender.type === 'SQUARE_GIFT_CARD') gift_card_tender += amount;\n else other_tender += amount;\n \n if (tender.processing_fee_money) {\n fees -= tender.processing_fee_money.amount || 0;\n }\n }\n }\n \n}\n\n// Final computed values\nconst net_sales = total_money - total_tip - total_tax - cash_rounding;\nconst gross_sales = net_sales - total_discount - total_returns;\nconst net_total = cash_tender + card_tender + gift_card_tender + other_tender + fees;\n\nreturn {\n json: {\n date,\n location_id,\n location_name,\n gross_sales: gross_sales / 100.0,\n total_returns: total_returns / 100.0,\n total_discount: total_discount / 100.0,\n net_sales: net_sales / 100.0,\n total_tax: total_tax / 100.0,\n total_tip: total_tip / 100.0,\n cash_rounding: cash_rounding / 100.0,\n total_payments_collected: total_money / 100.0,\n cash: cash_tender / 100.0,\n card: card_tender / 100.0,\n gift_card: gift_card_tender / 100.0,\n other: other_tender / 100.0,\n fees: fees / 100.0,\n net_total: net_total / 100.0,\n }\n};"
},
"typeVersion": 2
},
{
"id": "8ed9e5b4-77e9-4595-996e-a315470bf845",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1080,
-600
],
"parameters": {
"width": 660,
"height": 1120,
"content": "## Programatically Pull Square Report Data Into N8N\n\n## What It Does\nThis sub-workflow connects to the Square API and generates a daily sales summary report for all of your Square locations. The report matches the figures displayed in the Square Dashboard > Reports > Sales Summary.\n\nIt\u2019s designed to be reused in other workflows, ideal for reporting, data storage, accounting, or automation.\n\n## Prerequisites\nTo use this workflow, you'll need:\n- Square API credentials (configured as a Header Auth credential)\n\n## How to Set Up Square Credentials:\n- Go to Credentials > Create New\n- Choose Header Auth\n- Set the Name to \"Authorization\"\n- Set the Value to your Square Access Token (e.g., Bearer <your-api-key>)\n\n## Example Use Cases\n- Automatically store daily sales data in Google Sheets, MySQL, or PostgreSQL for analysis and historical tracking\n- Automatically send daily email or Slack reports to managers or finance teams\n- Build weekly/monthly reports by looping over multiple dates\n- Push sales data into accounting software like QuickBooks or Xero for automated bookkeeping\n- Calculate commissions or rent payments based on sales volume\n\n## How to Use\n- Configure both HTTP Request nodes to use your Square API credential.\n- If you are not in the Toronto/New York Timezone, please change the \"start_at\" and \"end_at\" parameters in the second HTTP node from \"-05:00\" to your local timezone\n- Use as a sub-workflow inside a main workflow.\n- Pass a report_date (formatted as YYYY-MM-DD) to the sub-workflow when you call it.\n\n## Customization Options\n- Add pagination to handle locations with more than 1,000 orders per day.\n- Expand the workflow to save or send the report output via additional integrations (email, database, webhook, etc.).\n\n## Why It's Useful\nThis workflow saves time, reduces manual report pulling from Square, and enables smarter automation around sales data\u2014whether for operations, finance, or performance monitoring.\n\n"
},
"typeVersion": 1
},
{
"id": "5886b9ec-679e-42cc-b63d-84cd2dd10f22",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-380,
-300
],
"parameters": {
"color": 7,
"height": 420,
"content": "## Trigger\n- This workflow should be executed by another workflow.\n- The main workflow should specify the report date in this format (YYYY-MM-DD)"
},
"typeVersion": 1
},
{
"id": "3b550817-8c61-40ef-8b43-9405b75b90f4",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-120,
-300
],
"parameters": {
"color": 7,
"width": 460,
"height": 420,
"content": "## Get Square Locations and Process Each One Separately\n- This HTTP node will connect to the Square Locations API to fetch all of your locations"
},
"typeVersion": 1
},
{
"id": "272b09dc-e8b9-484e-acf0-7515a2f71580",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
360,
-300
],
"parameters": {
"color": 7,
"height": 420,
"content": "## Get Sales from Square\n- This HTTP node will get all of the orders for the given location on the specified report date"
},
"typeVersion": 1
},
{
"id": "75ad5252-c9c6-49a2-bb7f-60feee6d2f64",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
900,
-300
],
"parameters": {
"color": 7,
"height": 420,
"content": "## Compile a Report for Each Location\n- This code node will calculate the totals for each location.\n- Please ensure the numbers match EXACTLY with the Square Sales Summary Dashboard"
},
"typeVersion": 1
},
{
"id": "d9ff9532-0bcf-4d66-bd86-e7a7f34d580b",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
360,
140
],
"parameters": {
"color": 3,
"height": 260,
"content": "## Timezone Warning\n- This HTTP Node is currently set to the **Toronto Timezone.** \n- If you have a different timezone, please update the setting by changing the \"start_at\" and \"end_at\" parameters from \"-05:00\" to your local timezone. \n- For example, in Brazil this would be \"-04:00\""
},
"typeVersion": 1
}
],
"connections": {
"Get Square Locations": {
"main": [
[
{
"node": "Turn Locations Into List",
"type": "main",
"index": 0
}
]
]
},
"Compile Sales Reports": {
"main": [
[]
]
},
"Get Sales from Square": {
"main": [
[
{
"node": "Ignore Locations w/o Sales",
"type": "main",
"index": 0
}
]
]
},
"Turn Locations Into List": {
"main": [
[
{
"node": "Get Sales from Square",
"type": "main",
"index": 0
}
]
]
},
"Ignore Locations w/o Sales": {
"main": [
[
{
"node": "Compile Sales Reports",
"type": "main",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Get Square Locations",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
httpHeaderAuth
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This sub-workflow connects to the Square API and generates a daily sales summary report for all of your Square locations. The report matches the figures displayed in the Square Dashboard > Reports > Sales Summary.
Source: https://n8n.io/workflows/6358/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This template is a powerful, reusable utility for managing stateful, long-running processes. It allows a main workflow to be paused indefinitely at "checkpoints" and then be resumed by external, async
Upload files from any source to your account Kommo or AmoCRM with a simple and reusable workflow. It can split a large file into small ones and upload chunks. Works for Kommo and amoCRM There are 3 re
Remixed Backup your workflows to GitHub from Solomon's work. Check out his templates.
Remixed Backup your workflows to GitHub from Solomon's work. Check out his templates.
This workflow audits your SharePoint Online environment for external sharing risks by identifying files and folders that are shared with anonymous links or external/guest users. It is designed to trav