gab*_*ans 7 javascript php windows
我想在本地 Windows 开发机器中测试 stripe webhooks,stripe 文档提到 stripe CLI 作为测试 webhooks 端点和发送虚假事件的最佳/更简单方法,我按照文档将 stripe CLI 下载到我的 Windows 机器中,我提取了可执行到我的桌面,但现在我不知道如何在我的cmd中正确执行命令。
stripe.exe 在我的桌面上,我首先尝试只需单击它,命令提示符打开并显示以下消息,几秒钟后命令提示符关闭。
This is a command line tool.
You need to open cmd.exe and run it from there.
Run Code Online (Sandbox Code Playgroud)
之后,我尝试打开 CMD 窗口并将 stripe.exe 拖放到选项卡中,我得到以下命令列表:
C:\Users\GABRIEL>C:\Users\GABRIEL\Desktop\stripe.exe
The official command-line tool to interact with Stripe.
Before using the CLI, you'll need to login:
$ stripe login
If you're working on multiple projects, you can run the login command with the
--project-name flag:
$ stripe login --project-name rocket-rides
Usage:
stripe [command]
Webhook commands:
listen Listen for webhook events
trigger Trigger test webhook events
Stripe commands:
logs Interact with Stripe API request logs
status Check the status of the Stripe API
Resource commands:
get Quickly retrieve resources from Stripe
charges Make requests (capture, create, list, etc) on charges
customers Make requests (create, delete, list, etc) on customers
payment_intents Make requests (cancel, capture, confirm, etc) on payment intents
... To see more resource commands, run `stripe resources help`
Other commands:
completion Generate bash and zsh completion scripts
config Manually change the config values for the CLI
feedback Provide us with feedback on the CLI
fixtures Run fixtures to populate your account with data
help Help about any command
login Login to your Stripe account
logout Logout of your Stripe account
open Quickly open Stripe pages
samples Sample integrations built by Stripe
serve Serve static files locally
version Get the version of the Stripe CLI
Flags:
--api-key string Your API key to use for the command
--color string turn on/off color output (on, off, auto)
--config string config file (default is
$HOME/.config/stripe/config.toml)
--device-name string device name
-h, --help help for stripe
--log-level string log level (debug, info, warn, error)
(default "info")
-p, --project-name string the project name to read from for config
(default "default")
-v, --version Get the version of the Stripe CLI
Use "stripe [command] --help" for more information about a command.
C:\Users\GABRIEL>
Run Code Online (Sandbox Code Playgroud)
如你所见,我无法输入任何命令,例如
stripe login
Run Code Online (Sandbox Code Playgroud)
我无法在 cmd 中使用 stripe cli 执行任何操作。
小智 7
要将 stripe.exe 文件的路径添加到 Windows 上的 PATH 环境变量中,请按照以下步骤操作:
按 Windows 键 + R 打开“运行”对话框。
在“运行”对话框中键入“sysdm.cpl”,然后按 Enter。这将打开“系统属性”窗口。
在“系统属性”窗口中,单击“高级”选项卡。
单击“环境变量”按钮。这将打开“环境变量”窗口。
在“环境变量”窗口的“系统变量”部分下,向下滚动并找到“路径”变量。选择它并单击“编辑”按钮。
在“编辑环境变量”窗口中,单击“新建”按钮添加新条目。
输入 stripe.exe 文件所在目录的完整路径。例如,如果 stripe.exe 文件位于 C:\Users\YourUsername\Desktop\stripe.exe 所在文件夹中,则应添加“C:\Users\YourUsername\Desktop\thefolderwherestripe.exeis located”作为新条目。
单击“确定”关闭所有窗口。
可能不需要,但最好重新启动计算机
重新启动后,您应该能够全局访问 stripe cli,尝试在 cmd 中使用 stripe -v
#请注意:很多人都像这样添加路径
这是错误的方式:C:\Users\YourUsername\Desktop\foldername\stripe.exe
这是正确的方法:C:\Users\YourUsername\Desktop\stripefolder
小智 4
您需要cd进入您存储的文件夹stripe.exe。在你的情况下是:
C:\Users\GABRIEL> cd Desktop
Run Code Online (Sandbox Code Playgroud)
然后你只需从那里运行 stripe 命令就可以了。例如:
C:\Users\GABRIEL\Desktop> stripe --help
Run Code Online (Sandbox Code Playgroud)
或者
C:\Users\GABRIEL\Desktop> stripe login
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6681 次 |
| 最近记录: |