> For the complete documentation index, see [llms.txt](https://doc.duaer.com/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/recipes/stripe-failed-payment-to-slack.md).

# 在 Duaer 里把 Stripe 付款失败推送到 Slack

在 Duaer 里，Stripe 订阅扣款失败时，把客户邮箱、金额、第几次尝试和发票链接推到 Slack 频道。
## 在 Duaer 里搭付款失败提醒

1. 加 [Stripe Trigger](/zh/integrations/builtin/trigger-nodes/duaer-nodes-base.stripetrigger.md)，连接 [Stripe 凭证](/zh/integrations/builtin/credentials/stripe.md)，Events 选 Invoice Payment_failed。
2. 接 [Slack](/zh/build/slack.md)，Resource 选 Message，Operation 选 Send，频道选 #billing。
3. 消息写：付款失败 {{ $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 }}
4. 发布数字组织。Stripe Trigger 发布后会在 Stripe 里注册 Webhook。

日元这类没有小数的币种，金额不要除以 100。

## 测试

凭证先用 Stripe 测试模式的密钥。给测试客户绑卡号 4000 0000 0000 0341（绑卡成功、扣款失败），开一个订阅，就会收到 invoice.payment_failed。频道收不到消息时，见 [Slack not_in_channel 排查](/zh/troubleshooting/slack-not-in-channel.md)。
## Questions

### Duaer 能在 Stripe 一次性付款失败时也提醒吗？

能。在 Duaer 的 Stripe Trigger 里再选 Payment Intent.payment_failed，金额字段改用 data.object.amount。

### Duaer 里能改成推送到企业微信吗？

能。把 Duaer 流程里的 Slack 节点换成企业微信群机器人，消息内容不变。

## 相关

- [在 Duaer 里用 Stripe 创建客户](https://doc.duaer.com/zh/build/stripe.md)
- [在 Duaer 里用 Slack 发消息](https://doc.duaer.com/zh/build/slack.md)
- [在 Duaer 里解决 Slack not_in_channel 和 channel_not_found](https://doc.duaer.com/zh/troubleshooting/slack-not-in-channel.md)

