{
  "name": "07 · Stripe Payment → Full Client Setup",
  "nodes": [
    {
      "name": "Stripe Checkout Complete",
      "type": "n8n-nodes-base.stripeTrigger",
      "typeVersion": 1,
      "position": [
        0,
        224
      ],
      "parameters": {
        "events": [
          "checkout.session.completed"
        ]
      },
      "webhookId": "8182316a-932b-4986-bb3d-094fb5bcb432",
      "credentials": {
        "stripeApi": {
          "id": "v8kDsMc8Q3lV9r9O",
          "name": "Stripe account"
        }
      }
    },
    {
      "name": "Extract Payment Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        224
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "email",
              "value": "={{ $json.data.object.customer_email }}",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "name",
              "value": "={{ $json.data.object.customer_details?.name || \"Customer\" }}",
              "type": "string"
            },
            {
              "id": "a3",
              "name": "plan",
              "value": "={{ $json.data.object.metadata?.plan || \"starter\" }}",
              "type": "string"
            },
            {
              "id": "a4",
              "name": "credits",
              "value": "={{ parseInt($json.data.object.metadata?.credits || \"50\") }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Create Client",
      "type": "n8n-nodes-lindo.lindo",
      "typeVersion": 1,
      "position": [
        448,
        224
      ],
      "parameters": {
        "resource": "client",
        "email": "={{ $json.email }}"
      },
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "Allocate Credits",
      "type": "n8n-nodes-lindo.lindo",
      "typeVersion": 1,
      "position": [
        672,
        224
      ],
      "parameters": {
        "resource": "credits",
        "clientId": "={{ $json.client_id }}",
        "amount": "={{ $(\"Extract Payment Data\").first().json.credits }}",
        "additionalFields": {}
      },
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "Create Website",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        896,
        224
      ],
      "parameters": {
        "promptType": "define",
        "text": "=Create a professional website for this new paying customer using the Lindo tool.\n\nCustomer: {{ $(\"Extract Payment Data\").first().json.name }}\nPlan: {{ $(\"Extract Payment Data\").first().json.plan }}\n\nGenerate a polished business website. Return the workflow_id.",
        "options": {
          "systemMessage": "Create a website for a new paying customer. Use the Lindo tool."
        }
      }
    },
    {
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        912,
        448
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "Yuica5wlzDrhFTNk",
          "name": "OpenAi account"
        }
      }
    },
    {
      "name": "Lindo Create Website",
      "type": "n8n-nodes-lindo.lindoTool",
      "typeVersion": 1,
      "position": [
        1040,
        448
      ],
      "parameters": {
        "prompt": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt', '') }}"
      },
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "Persist Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1248,
        224
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b1",
              "name": "workflow_id",
              "value": "={{ $json.output.match(/workflow_id[:\\\\s]*([\\\\w-]+)/)?.[1] || \"\" }}",
              "type": "string"
            },
            {
              "id": "b2",
              "name": "client_id",
              "value": "={{ $(\"Create Client\").first().json.client_id }}",
              "type": "string"
            },
            {
              "id": "b3",
              "name": "email",
              "value": "={{ $(\"Extract Payment Data\").first().json.email }}",
              "type": "string"
            },
            {
              "id": "b4",
              "name": "name",
              "value": "={{ $(\"Extract Payment Data\").first().json.name }}",
              "type": "string"
            },
            {
              "id": "b5",
              "name": "credits",
              "value": "={{ $(\"Extract Payment Data\").first().json.credits }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Check Website Status",
      "type": "n8n-nodes-lindo.lindo",
      "typeVersion": 1,
      "position": [
        1472,
        224
      ],
      "parameters": {
        "resource": "workflow",
        "workflowId": "={{ $(\"Persist Data\").first().json.workflow_id }}"
      },
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "Carry Forward",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1696,
        160
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c1",
              "name": "done",
              "value": "={{ $json.done }}",
              "type": "boolean"
            },
            {
              "id": "c2",
              "name": "website_url",
              "value": "={{ $json.result?.domain || \"\" }}",
              "type": "string"
            },
            {
              "id": "c3",
              "name": "client_id",
              "value": "={{ $(\"Persist Data\").first().json.client_id }}",
              "type": "string"
            },
            {
              "id": "c4",
              "name": "email",
              "value": "={{ $(\"Persist Data\").first().json.email }}",
              "type": "string"
            },
            {
              "id": "c5",
              "name": "name",
              "value": "={{ $(\"Persist Data\").first().json.name }}",
              "type": "string"
            },
            {
              "id": "c6",
              "name": "credits",
              "value": "={{ $(\"Persist Data\").first().json.credits }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Done?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        1920,
        160
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "d1",
              "leftValue": "={{ $json.done }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "name": "Generate Magic Link",
      "type": "n8n-nodes-lindo.lindo",
      "typeVersion": 1,
      "position": [
        2144,
        112
      ],
      "parameters": {
        "resource": "client",
        "operation": "generateMagicLink",
        "clientId": "={{ $json.client_id }}"
      },
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "Send Welcome Email",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        2368,
        112
      ],
      "parameters": {
        "promptType": "define",
        "text": "=Send a welcome email to the new paying customer.\n\nCustomer: {{ $(\"Carry Forward\").first().json.name }} ({{ $(\"Carry Forward\").first().json.email }})\nWebsite: {{ $(\"Carry Forward\").first().json.website_url }}\nCredits: {{ $(\"Carry Forward\").first().json.credits }}\nMagic Link: {{ $json.magic_link }}\n\nCompose a warm welcome: congratulate on purchase, show site URL, mention credit balance, include magic link to dashboard. Send via Emailr.",
        "options": {
          "systemMessage": "Welcome email for new paying customer. Include site URL, credits, and portal link."
        }
      }
    },
    {
      "name": "OpenAI Email",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        2384,
        336
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "Yuica5wlzDrhFTNk",
          "name": "OpenAi account"
        }
      }
    },
    {
      "name": "Emailr",
      "type": "n8n-nodes-emailr.emailrTool",
      "typeVersion": 1,
      "position": [
        2512,
        336
      ],
      "parameters": {
        "from": "lindo.ai <sales@lindo.ai>",
        "to": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', '') }}",
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', '') }}",
        "html": "=",
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text_Body', ``, 'string') }}"
      },
      "credentials": {
        "emailrApi": {
          "id": "1QJ6NqiurNRi9d4C",
          "name": "Emailr account"
        }
      }
    },
    {
      "name": "Wait 60s",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        2144,
        320
      ],
      "parameters": {
        "amount": 60
      },
      "webhookId": "285efd02-bb8c-4d47-afee-d28001ac84d2"
    },
    {
      "name": "Sticky Note ae934fd7",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1248,
        496
      ],
      "parameters": {
        "content": "### 07 · Stripe Payment → Full Client Setup\n\n**How it works:** Stripe checkout.session.completed → extracts customer data → creates Lindo client → allocates credits by plan → AI builds website → polls status → generates magic link → sends welcome email with site URL, credits, and dashboard access.\n\n**Setup:** Connect Stripe webhook for checkout.session.completed. Set plan/credits in Stripe metadata. Configure Emailr credentials.\n\n**Customisation:** Adjust credit allocation formula. Change welcome email tone. Add Slack notification for new signups. Extend with onboarding sequence (drip emails).",
        "color": 2,
        "width": 2668,
        "height": 408
      }
    },
    {
      "name": "Sticky Note d0d7f0c7",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1248,
        496
      ],
      "parameters": {
        "content": "## Payment & Client Setup\nStripe checkout → extract data → create Lindo client → allocate credits based on plan.",
        "color": 1,
        "width": 972,
        "height": 200
      }
    },
    {
      "name": "Sticky Note 349104a3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1248,
        496
      ],
      "parameters": {
        "content": "## AI Website Build\nGPT-4o agent creates a polished website. Polls status every 60s until live.",
        "color": 1,
        "width": 1548,
        "height": 360
      }
    },
    {
      "name": "Sticky Note ba8653a9",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1248,
        496
      ],
      "parameters": {
        "content": "## Welcome Delivery\nMagic link generated, AI composes personalised welcome email with all details.",
        "color": 1,
        "width": 524,
        "height": 200
      }
    }
  ],
  "connections": {
    "Stripe Checkout Complete": {
      "main": [
        [
          {
            "node": "Extract Payment Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Payment Data": {
      "main": [
        [
          {
            "node": "Create Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Client": {
      "main": [
        [
          {
            "node": "Allocate Credits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Allocate Credits": {
      "main": [
        [
          {
            "node": "Create Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Website": {
      "main": [
        [
          {
            "node": "Persist Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "ai_languageModel": [
        [
          {
            "node": "Create Website",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Lindo Create Website": {
      "ai_tool": [
        [
          {
            "node": "Create Website",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Persist Data": {
      "main": [
        [
          {
            "node": "Check Website Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Website Status": {
      "main": [
        [
          {
            "node": "Carry Forward",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Carry Forward": {
      "main": [
        [
          {
            "node": "Done?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Done?": {
      "main": [
        [
          {
            "node": "Generate Magic Link",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 60s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Magic Link": {
      "main": [
        [
          {
            "node": "Send Welcome Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Email": {
      "ai_languageModel": [
        [
          {
            "node": "Send Welcome Email",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Emailr": {
      "ai_tool": [
        [
          {
            "node": "Send Welcome Email",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wait 60s": {
      "main": [
        [
          {
            "node": "Check Website Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}