{
  "name": "Create and send multi-item PayPal invoices via email",
  "nodes": [
    {
      "id": "63de70dc-48ba-45a8-9e6e-3ba7cc2e7cf8",
      "name": "PayPal | Encode Basic Auth Token",
      "type": "n8n-nodes-base.code",
      "position": [
        380,
        -920
      ]
    },
    {
      "id": "73faca88-4d2e-43cd-aaa4-1825bde017bb",
      "name": "Remove Client ID and Secret Key",
      "type": "n8n-nodes-base.set",
      "position": [
        740,
        -1220
      ]
    },
    {
      "id": "f6c75cde-4c28-4b26-8838-6434114043af",
      "name": "Set Invoice Number and Date",
      "type": "n8n-nodes-base.code",
      "position": [
        380,
        -1220
      ]
    },
    {
      "id": "7707fd9f-b85b-40af-9693-d583764cd514",
      "name": "Add href link for Preview",
      "type": "n8n-nodes-base.merge",
      "position": [
        1560,
        -1220
      ]
    },
    {
      "id": "0a0ac88b-52fc-4fa2-96ac-2d5a55af82c3",
      "name": "Get Preview URL",
      "type": "n8n-nodes-base.code",
      "position": [
        1820,
        -1220
      ]
    },
    {
      "id": "04eca937-60f7-45d4-a452-95d1bcc4b7b3",
      "name": "Reformat JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        -2100,
        -1520
      ]
    },
    {
      "id": "95261691-5fe1-46d5-8f7d-5a3be90699fb",
      "name": "Add Another Item",
      "type": "n8n-nodes-base.form",
      "position": [
        -2420,
        -680
      ]
    },
    {
      "id": "aa0dd700-d637-4ef2-9432-6b75309fc5fe",
      "name": "Remove Add Decision",
      "type": "n8n-nodes-base.code",
      "position": [
        -2640,
        -900
      ]
    },
    {
      "id": "8324b154-1a3b-4c69-9eaa-4e82360adcc7",
      "name": "Reformat newItem JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        -2180,
        -680
      ]
    },
    {
      "id": "c48ae217-0526-4d84-9e86-e3f4a5558fa5",
      "name": "Append newItem into items with currency_code",
      "type": "n8n-nodes-base.code",
      "position": [
        -1740,
        -900
      ]
    },
    {
      "id": "b069144e-afdd-4484-b663-4489d6aa031b",
      "name": "Collect Invoice Details",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -2580,
        -1520
      ]
    },
    {
      "id": "bd62935d-22c5-4d08-b98e-d340d3ede737",
      "name": "Prompt for Additional Line-Item",
      "type": "n8n-nodes-base.form",
      "position": [
        -1700,
        -1360
      ]
    },
    {
      "id": "7a8e8566-9485-41ad-8730-06e4d3bbea51",
      "name": "Prompt for Additional Line-Item 1",
      "type": "n8n-nodes-base.form",
      "position": [
        -1440,
        -680
      ]
    },
    {
      "id": "e408be60-75dc-40cb-b1f2-5932ae0dc6f0",
      "name": "Loop: More Items?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -460,
        -680
      ]
    },
    {
      "id": "d1c9d3f3-f2f7-4fe5-a2d8-1bc047d96e44",
      "name": "Combine New Items Into Master List",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1960,
        -900
      ]
    },
    {
      "id": "c90eb155-7af5-437e-999f-feaf9c309f27",
      "name": "Fetch OAuth Token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        740,
        -920
      ]
    },
    {
      "id": "b5c25f9a-09fc-44e9-b5db-55e83b7fdab0",
      "name": "Call PayPal Create Invoice",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1240,
        -920
      ]
    },
    {
      "id": "cde91e5b-4587-431d-b9fd-3c8bb442f74a",
      "name": "Dispatch Invoice via PayPal",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2200,
        -1220
      ]
    },
    {
      "id": "66192979-452f-4c60-8a15-1ac2dd9f3dab",
      "name": "Merge Base Invoice & Add-Item Decision",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1300,
        -1500
      ]
    },
    {
      "id": "0d5fceaf-560f-4d71-ae9f-f35e575dc7bb",
      "name": "Merge Updated Items & Add-Item Decision",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1180,
        -900
      ]
    },
    {
      "id": "0d70c9d7-fc5f-4401-a40b-19b59acbd3a3",
      "name": "Strip Add-Item Loop Metadata",
      "type": "n8n-nodes-base.code",
      "position": [
        -40,
        -1220
      ]
    },
    {
      "id": "bbe3093b-b360-4555-82a8-fba84a1b726d",
      "name": "Merge Invoice Creation Response & Preview Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        1000,
        -1220
      ]
    },
    {
      "id": "7eb8f035-05c2-4e51-991b-2b175b902de6",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2780,
        -1800
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "69da90c1-ea37-423d-8591-c90b3d125180",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2780,
        -2040
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "13472852-3b1a-42d2-8ece-b9592ee1982c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2780,
        -1000
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "bf8b8a33-d152-43ba-8103-bf67871320a8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -1360
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "405f8114-34b9-4269-b552-cf62469012ae",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        -1400
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "5871edf3-6dc4-4281-a63e-8320d7811a62",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2020,
        -1460
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    }
  ],
  "connections": {
    "Reformat JSON": {
      "main": [
        [
          {
            "node": "Prompt for Additional Line-Item",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Base Invoice & Add-Item Decision",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Preview URL": {
      "main": [
        [
          {
            "node": "Dispatch Invoice via PayPal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Another Item": {
      "main": [
        [
          {
            "node": "Reformat newItem JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch OAuth Token": {
      "main": [
        [
          {
            "node": "Merge Invoice Creation Response & Preview Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Loop: More Items?": {
      "main": [
        [
          {
            "node": "Strip Add-Item Loop Metadata",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Remove Add Decision",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Add Decision": {
      "main": [
        [
          {
            "node": "Add Another Item",
            "type": "main",
            "index": 0
          },
          {
            "node": "Combine New Items Into Master List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reformat newItem JSON": {
      "main": [
        [
          {
            "node": "Combine New Items Into Master List",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Collect Invoice Details": {
      "main": [
        [
          {
            "node": "Reformat JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add href link for Preview": {
      "main": [
        [
          {
            "node": "Get Preview URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call PayPal Create Invoice": {
      "main": [
        [
          {
            "node": "Add href link for Preview",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set Invoice Number and Date": {
      "main": [
        [
          {
            "node": "Remove Client ID and Secret Key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Strip Add-Item Loop Metadata": {
      "main": [
        [
          {
            "node": "Set Invoice Number and Date",
            "type": "main",
            "index": 0
          },
          {
            "node": "PayPal | Encode Basic Auth Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prompt for Additional Line-Item": {
      "main": [
        [
          {
            "node": "Merge Base Invoice & Add-Item Decision",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Remove Client ID and Secret Key": {
      "main": [
        [
          {
            "node": "Merge Invoice Creation Response & Preview Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PayPal | Encode Basic Auth Token": {
      "main": [
        [
          {
            "node": "Fetch OAuth Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prompt for Additional Line-Item 1": {
      "main": [
        [
          {
            "node": "Merge Updated Items & Add-Item Decision",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Combine New Items Into Master List": {
      "main": [
        [
          {
            "node": "Append newItem into items with currency_code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Base Invoice & Add-Item Decision": {
      "main": [
        [
          {
            "node": "Loop: More Items?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Updated Items & Add-Item Decision": {
      "main": [
        [
          {
            "node": "Loop: More Items?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append newItem into items with currency_code": {
      "main": [
        [
          {
            "node": "Merge Updated Items & Add-Item Decision",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prompt for Additional Line-Item 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Invoice Creation Response & Preview Data": {
      "main": [
        [
          {
            "node": "Call PayPal Create Invoice",
            "type": "main",
            "index": 0
          },
          {
            "node": "Add href link for Preview",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}