Stripe 支付失败实时告警
第 6 部分 · 案例 3.2 · 🛒 电商 SaaS
难度 🟢 简单 · 耗时 ~15 分钟 · 核心节点 Stripe Trigger × IF × Slack
支付失败 = 失去客户。让团队第一时间知道、并按金额分级处理是基本功。这个 workflow 监听 Stripe payment_failed 事件,>$50 进 #payments-critical 频道(需要立刻人工跟进),其他进 #payments,统一落库到 Airtable 做后续分析。
- SaaS / 电商:丢一单可能丢一个客户终身价值
- 财务团队需要月度失败原因统计
- 高价单需要客服主动联系挽回
🔍 工作流连线图
Section titled “🔍 工作流连线图” ▦ workflow stripe-failures.workflow.json Lv.1
📋 关键节点
Section titled “📋 关键节点”Stripe Trigger
Section titled “Stripe Trigger” ⚙ stripe-trigger.txt
Events: [payment_intent.payment_failed]
Credentials: Stripe Secret Key
n8n 自动在 Stripe 注册 webhook endpoint。
IF amount > $50
Section titled “IF amount > $50” ⚙ if-amount.txt
Conditions:
Value 1: ={{ $json.data.object.amount }} ← Stripe 用 cents
Operator: >
Value 2: 5000 ← 即 $50.00
Slack Critical(高价)
Section titled “Slack Critical(高价)” ⚙ slack-critical.txt
Channel: #payments-critical
Text:
🚨 HIGH-VALUE payment failed
Customer: {{ $json.data.object.customer }}
Amount: ${{ $json.data.object.amount / 100 }}
Reason: {{ $json.data.object.last_payment_error.message }}
Log to Airtable
Section titled “Log to Airtable”两条分支(critical / normal)都汇到 Airtable 表里做后续分析:
⚙ airtable-log.txt
Operation: Create Record
Table: failed_payments
Fields:
customer_id: ={{ $json.data.object.customer }}
amount: ={{ $json.data.object.amount / 100 }}
reason: ={{ $json.data.object.last_payment_error.message }}
failed_at: ={{ $now.toISO() }}
📥 一键复制 Workflow JSON
Section titled “📥 一键复制 Workflow JSON” 📋 stripe-failures.workflow.json