应用配方
在 Duaer 里把 Stripe 付款失败推送到 Slack
在 Duaer 里,Stripe 订阅扣款失败时,把客户邮箱、金额、第几次尝试和发票链接推到 Slack 频道。
在 Duaer 里搭付款失败提醒
- 加 Stripe Trigger,连接 Stripe 凭证,Events 选 Invoice Payment_failed。
- 接 Slack,Resource 选 Message,Operation 选 Send,频道选 #billing。
- 消息写:付款失败 {{ $json.data.object.customer_email }},{{ ($json.data.object.amount_due / 100).toFixed(2) }} {{ $json.data.object.currency.toUpperCase() }},第 {{ $json.data.object.attempt_count }} 次。发票:{{ $json.data.object.hosted_invoice_url }}
- 发布数字组织。Stripe Trigger 发布后会在 Stripe 里注册 Webhook。
日元这类没有小数的币种,金额不要除以 100。
测试
凭证先用 Stripe 测试模式的密钥。给测试客户绑卡号 4000 0000 0000 0341(绑卡成功、扣款失败),开一个订阅,就会收到 invoice.payment_failed。频道收不到消息时,见 Slack not_in_channel 排查。
常见问题
Duaer 能在 Stripe 一次性付款失败时也提醒吗?
能。在 Duaer 的 Stripe Trigger 里再选 Payment Intent.payment_failed,金额字段改用 data.object.amount。
Duaer 里能改成推送到企业微信吗?
能。把 Duaer 流程里的 Slack 节点换成企业微信群机器人,消息内容不变。
同组
节点
在 Duaer 里用 Stripe 创建客户
在 Duaer 里,Stripe 默认 Resource 是 Balance。创建客户时改成 Customer,Operation 选 Create,Name 必填。需要 stripeApi 凭据。
节点在 Duaer 里用 Slack 发消息
在 Duaer 里,Slack 默认 Authentication 是 Access Token,Resource 是 Message,Operation 是 Send。Message Type 默认 Simple Text Message。
报错在 Duaer 里解决 Slack not_in_channel 和 channel_not_found
Duaer 的 Slack 节点发消息报 not_in_channel,是 Slack 应用没加入这个频道。把应用邀请进频道就好。