{
  "name": "Stripe -> Email",
  "type": "SHARED",
  "summary": "",
  "description": "",
  "tags": [],
  "blogUrl": "",
  "metadata": {
    "externalId": "TEMPLATE"
  },
  "author": "Your Name",
  "categories": [],
  "pieces": [
    "@activepieces/piece-stripe",
    "@activepieces/piece-math-helper",
    "@activepieces/piece-google-sheets",
    "@activepieces/piece-gmail"
  ],
  "flows": [
    {
      "displayName": "Stripe -> Email",
      "trigger": {
        "name": "trigger",
        "valid": true,
        "displayName": "Checkout Session Completed",
        "nextAction": {
          "name": "step_3",
          "skip": false,
          "type": "PIECE",
          "valid": true,
          "settings": {
            "input": {
              "first_number": "{{trigger['output']['amount_total']}}",
              "second_number": "100"
            },
            "pieceName": "@activepieces/piece-math-helper",
            "actionName": "division_math",
            "sampleData": {},
            "pieceVersion": "0.0.21",
            "propertySettings": {
              "first_number": {
                "type": "MANUAL"
              },
              "second_number": {
                "type": "MANUAL"
              }
            },
            "errorHandlingOptions": {
              "retryOnFailure": {
                "value": false
              },
              "continueOnFailure": {
                "value": false
              }
            }
          },
          "nextAction": {
            "name": "step_2",
            "skip": false,
            "type": "PIECE",
            "valid": true,
            "settings": {
              "input": {
                "auth": "{{connections['YOUR_GOOGLE_SHEETS_CONNECTION']}}",
                "values": {
                  "A": "{{trigger['output']['customer_details']['email']}}",
                  "B": "{{step_3['output']}}",
                  "C": "{{trigger['output']['payment_intent']}}"
                },
                "sheetId": 0,
                "as_string": false,
                "spreadsheetId": "YOUR_GOOGLE_SHEET_ID",
                "first_row_headers": true,
                "includeTeamDrives": false
              },
              "pieceName": "@activepieces/piece-google-sheets",
              "actionName": "insert_row",
              "sampleData": {},
              "pieceVersion": "0.13.1",
              "propertySettings": {
                "values": {
                  "type": "DYNAMIC",
                  "schema": {
                    "A": {
                      "type": "SHORT_TEXT",
                      "required": false,
                      "description": "cus_name",
                      "displayName": "cus_name",
                      "defaultValue": ""
                    },
                    "B": {
                      "type": "SHORT_TEXT",
                      "required": false,
                      "description": "payment_amount",
                      "displayName": "payment_amount",
                      "defaultValue": ""
                    },
                    "C": {
                      "type": "SHORT_TEXT",
                      "required": false,
                      "description": "txn_id",
                      "displayName": "txn_id",
                      "defaultValue": ""
                    }
                  }
                },
                "sheetId": {
                  "type": "MANUAL"
                },
                "as_string": {
                  "type": "MANUAL"
                },
                "spreadsheetId": {
                  "type": "MANUAL"
                },
                "first_row_headers": {
                  "type": "MANUAL"
                },
                "includeTeamDrives": {
                  "type": "MANUAL"
                }
              },
              "errorHandlingOptions": {
                "retryOnFailure": {
                  "value": true
                },
                "continueOnFailure": {
                  "value": false
                }
              }
            },
            "nextAction": {
              "name": "step_1",
              "skip": false,
              "type": "PIECE",
              "valid": true,
              "settings": {
                "input": {
                  "cc": [],
                  "bcc": [],
                  "auth": "{{connections['YOUR_GMAIL_CONNECTION']}}",
                  "body": "สวัสดีค้าบ\nขอบคุณมากเลยนะครับที่ไว้วางใจสั่งซื้อ [ชื่อสินค้าของคุณ]\n-------------------------------------\nเริ่มใช้งาน/เริ่มเรียนได้เลยที่ลิงก์นี้:\nhttps://drive.google.com/drive/folders/YOUR_PRODUCT_FOLDER_ID\n-------------------------------------\nทางเข้าคอมมูนิตี้ (ถ้ามี):\nhttps://discord.gg/yourInviteCode\n-------------------------------------\nมีคำถามอะไรทักมาได้เลยนะครับ ยินดีช่วยจริงๆ\n\nขอบคุณอีกครั้งครับ :)\n[ชื่อของคุณ]",
                  "from": "your-email@gmail.com",
                  "draft": false,
                  "subject": "นำส่ง [ชื่อสินค้าของคุณ] ครับ",
                  "receiver": [
                    "{{trigger['output']['customer_details']['email']}}"
                  ],
                  "reply_to": [],
                  "body_type": "plain_text",
                  "attachments": [],
                  "sender_name": "Your Name"
                },
                "pieceName": "@activepieces/piece-gmail",
                "actionName": "send_email",
                "sampleData": {},
                "pieceVersion": "0.9.6",
                "propertySettings": {
                  "cc": {
                    "type": "MANUAL"
                  },
                  "bcc": {
                    "type": "MANUAL"
                  },
                  "body": {
                    "type": "MANUAL"
                  },
                  "from": {
                    "type": "MANUAL"
                  },
                  "draft": {
                    "type": "MANUAL"
                  },
                  "subject": {
                    "type": "MANUAL"
                  },
                  "receiver": {
                    "type": "MANUAL"
                  },
                  "reply_to": {
                    "type": "MANUAL"
                  },
                  "body_type": {
                    "type": "MANUAL"
                  },
                  "attachments": {
                    "type": "MANUAL"
                  },
                  "in_reply_to": {
                    "type": "MANUAL"
                  },
                  "sender_name": {
                    "type": "MANUAL"
                  }
                },
                "errorHandlingOptions": {
                  "retryOnFailure": {
                    "value": false
                  },
                  "continueOnFailure": {
                    "value": false
                  }
                }
              },
              "displayName": "Send Email",
              "lastUpdatedDate": "2026-05-08T11:12:06.604Z"
            },
            "displayName": "Insert Row",
            "lastUpdatedDate": "2026-05-08T11:12:06.604Z"
          },
          "displayName": "Division",
          "lastUpdatedDate": "2026-05-08T11:12:06.604Z"
        },
        "lastUpdatedDate": "2026-05-08T11:12:06.603Z",
        "type": "PIECE_TRIGGER",
        "settings": {
          "sampleData": {},
          "propertySettings": {
            "customer": {
              "type": "MANUAL"
            }
          },
          "pieceName": "@activepieces/piece-stripe",
          "pieceVersion": "0.5.16",
          "triggerName": "checkout_session_completed",
          "input": {
            "auth": "{{connections['YOUR_STRIPE_CONNECTION']}}"
          }
        }
      },
      "valid": true,
      "schemaVersion": "22",
      "notes": []
    }
  ],
  "status": "PUBLISHED"
}