gpt4 book ai didi

stripe-payments - 在 Stripe CLI 中使用 fixtures

转载 作者:行者123 更新时间:2023-12-05 08:39:24 24 4
gpt4 key购买 nike

我想通过使用 Stripe CLI 触发一些特定请求来测试我的 API 行为.

例如:

strip 触发器 customer.subscription.deleted # 这里有一些固定装置

有一个 fixtures 命令记录为一个功能,但我不知道如何使用它。文档说:

The fixtures command lets you run a json file as a series of API requests. This can be useful for things like filling data, executing specific flows, or testing API behavior.

https://github.com/stripe/stripe-cli/wiki/fixtures-command

如何将夹具加载到 CLI 中?

最佳答案

第一步是创建一个包含灯具的 JSON 文件。您链接到的文档提供了一个这样的示例,但如果您:

  • 找到最接近你想做的事情的可用触发器
  • 找到相应的夹具文件in the repo
  • 根据您的需要修改它

然后您可以使用 stripe fixtures name_of_your_fixture_file.json 执行夹具

您可以在 trigger documentation 中查找可用的触发器.请记住,固定装置只会发出一系列 API 请求,fixtures 数组中的每个对象代表一个 API 调用,因此您可以执行 API docs 中指定的任何操作。 .

关于stripe-payments - 在 Stripe CLI 中使用 fixtures,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59745126/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com