用途
Stripe Auto-Setup 用于将 Stripe 账户与 Affitor 连接,自动配置 webhook 以实现联盟销售追踪。它通过 CLI 的 OAuth 授权流程完成连接,无需手动在 Stripe 后台逐项设置。触发词包括 "stripe setup"、"webhook setup"、"stripe integration"。
主要能力
运行快速设置命令后,该技能会执行以下操作:
- 打开浏览器授权 Stripe Connect(只读访问)
- 在 Stripe 账户上创建一个指向 Affitor 的 webhook 端点
- 订阅所需的支付事件
- 将连接保存到你的 Affitor 项目
配置的 webhook 事件
CLI 创建的 webhook 端点会监听以下事件:
| 事件 | 用途 |
|---|---|
| customer.created | 新客户归因 |
| checkout.session.completed | 一次性支付追踪 |
| invoice.paid | 订阅支付追踪 |
| invoice.payment_failed | 支付失败处理 |
| charge.refunded | 退款处理 |
| customer.subscription.deleted | 流失追踪 |
使用方式
快速设置命令:
npx affitor setup stripe
前置条件:
- 先运行
npx affitor init(创建你的项目) - 拥有具备 API 访问权限的 Stripe 账户
- 项目中必须存在
.affitor/config.json
设置完成后:
验证连接:
npx affitor status
测试销售事件:
npx affitor test sale
你也可以在 Stripe Dashboard 的 Developers → Webhooks 中验证,应能看到列出的 Affitor 端点。
手动替代方案
如果你不想使用 OAuth,可以改为手动添加 Stripe metadata。参见 sale-tracking 技能了解 metadata 方式。
适用场景
适用于使用 Stripe 收款、并希望通过 Affitor 追踪联盟销售与订阅支付的场景,包括新客户归因、一次性支付、订阅续费、支付失败、退款和流失追踪。
限制
资料未提供关于收费、价格、平台兼容范围或效果保证的信息。使用前必须满足上述前置条件,且 OAuth 授权为只读访问。