Stripe CLI
$ stripe 官方出品 高风险Stripe CLI 让开发者与编码 Agent 在终端中触发测试 Webhook 事件、实时查看 API 日志并调用 Stripe REST 资源。默认运行在 Test Mode,必须显式传 --live 才能触及生产数据,为金融支付开发提供天然安全边界。
brew install stripe/stripe-cli/stripe 本地 Webhook 转发(stripe listen)与测试夹具触发(stripe trigger)必须用 Stripe CLI;纯只读账单查询可考虑 Stripe 官方 MCP。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
API 资源子命令直接输出干净 JSON 且支持非交互参数,但 listen 与 logs tail 属于常驻流式阻塞命令。
- API resource commands output JSON directly to stdout
stripe listenstreams indefinitely unless bounded by timeout
默认启用 Test Mode 并强制要求 --live 才切入生产,为支付类 API 提供了极佳的默认安全边界。
- Test mode default with explicit
--liveopt-in - Supports restricted API keys via
--api-key
单 Go 二进制,覆盖 Homebrew、Docker、Scoop 与 apt/yum。
- Official Homebrew tap and cross-platform releases
在支付集成开发的本地 Webhook 调试与夹具模拟场景中无可替代。
stripe listenandstripe triggersolve local webhook testing
Stripe 官方团队(stripe/stripe-cli)以 Apache-2.0 协议持续维护。
- Official Stripe GitHub repository
Stripe 官方文档完整覆盖命令、Webhook 与测试事件。
- Official docs at docs.stripe.com/stripe-cli
安全边界、鉴权与放权指南
将受限会话密钥保存在 ~/.config/stripe/config.toml,或通过 --api-key / STRIPE_API_KEY 传入。
CLI 开源免费(Apache-2.0);Stripe 测试/沙箱模式无交易手续费。
# Stripe CLI Agent Rules - Stay strictly in Test Mode; NEVER pass `--live` or live `sk_live_` keys in autonomous runs. - Prefer `stripe trigger` and `stripe listen` for integration verification. - Require explicit human approval before creating refunds, payouts, or live customers.
Agent 高频安全命令配方
只读查询(安全推荐)
stripe payment_intents list --limit 5
默认锁定测试模式并返回结构化 JSON 资源对象。
stripe trigger payment_intent.succeeded
在 Stripe 测试模式中模拟标准 Webhook 载荷用于联调。
受控写入与预演
stripe listen --forward-to localhost:4242/webhook
把测试事件流式转发到本地端口,完全不改写线上计费数据。
核心优势
- + 默认 Test Mode 隔离机制防止 Agent 误操作真实线上资金,除非显式传
--live。 - + 资源子命令返回与 Stripe REST Schema 一致的干净 JSON。
- +
stripe listen与stripe trigger是编码 Agent 联调支付回调的刚需。
注意事项与踩坑点
- !
stripe listen等流式命令若不后台运行会导致 Agent 同步等待超时。 - ! 写入类 API 子命令缺少通用的
--dry-run预演参数。