admin管理员组文章数量:1193808
I want to test stripe webhooks in my local windows dev machine, stripe docs mention stripe CLI as the best /easier way to test webhooks endpoints and sending fake events, I followed the docs to down load stripe CLI into my windows machine, I extracted the executable into my desktop but now I don't know how to properly excute commands in my cmd.
stripe.exe in my desktop, I first tried just simply clicking it, command prompt opened and showed message bellow, after a few seconds the command prompt closes.
This is a command line tool.
You need to open cmd.exe and run it from there.
After that I tried opening a CMD window and drag and dropping stripe.exe into the tab, I get the following list of commands:
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>
as you see I can't type any command, something like
stripe login
I'm left with no option to do anything with stripe cli in cmd.
I want to test stripe webhooks in my local windows dev machine, stripe docs mention stripe CLI as the best /easier way to test webhooks endpoints and sending fake events, I followed the docs to down load stripe CLI into my windows machine, I extracted the executable into my desktop but now I don't know how to properly excute commands in my cmd.
stripe.exe in my desktop, I first tried just simply clicking it, command prompt opened and showed message bellow, after a few seconds the command prompt closes.
This is a command line tool.
You need to open cmd.exe and run it from there.
After that I tried opening a CMD window and drag and dropping stripe.exe into the tab, I get the following list of commands:
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>
as you see I can't type any command, something like
stripe login
I'm left with no option to do anything with stripe cli in cmd.
Share Improve this question edited Mar 26, 2023 at 18:48 Benjamin Loison 5,6124 gold badges19 silver badges37 bronze badges asked Aug 1, 2020 at 12:23 gabogabansgabogabans 3,5539 gold badges50 silver badges109 bronze badges6 Answers
Reset to default 15To add the path of the stripe.exe file to your PATH environment variable on Windows, follow these steps:
Press the Windows key + R to open the Run dialog box.
Type "sysdm.cpl" in the Run dialog box and press Enter. This will open the System Properties window.
In the System Properties window, click on the "Advanced" tab.
Click on the "Environment Variables" button. This will open the Environment Variables window.
In the Environment Variables window, under the "System variables" section, scroll down and locate the "Path" variable. Select it and click on the "Edit" button.
In the Edit Environment Variable window, click on the "New" button to add a new entry.
Enter the full path to the directory where you have the stripe.exe file located. For example, if the stripe.exe file is in C:\Users\YourUsername\Desktop\the folder where stripe.exe is located, you would add 'C:\Users\YourUsername\Desktop\thefolderwherestripe.exeislocated' as a new entry.
Click "OK" to close all the windows.
Might not be needed but it is better to restart your computer
After restarting you should be able to access stripe cli globally, try stripe -v in cmd
#Please Note: a lot of people are adding the path like so
this is the wrong way: C:\Users\YourUsername\Desktop\foldername\stripe.exe
this is the correct way: C:\Users\YourUsername\Desktop\stripefolder
You need to cd
into the folder where you have stored stripe.exe
. In your case that's:
C:\Users\GABRIEL> cd Desktop
Then you simply run stripe commands from there and it'll work. For instance:
C:\Users\GABRIEL\Desktop> stripe --help
OR
C:\Users\GABRIEL\Desktop> stripe login
".\stripe login" works not other in windows i faced lots of issues by using stripe login , where that will not work after 100 attempts i tried .\stripe login and it worked finally
we can use directly the file to run stripe login like this
plz go to the folder where you stored the stripe.exe file then open terminal there and just type .\stripe.exe login
Using system variables
I know this is an old question, but i wanted to post this fairly simple answer which is useful also later on while bumping into these kind of problems.
I also do think the other answers are good options when using it once, but when using stripe commands consistently here is my solution:
Create a new folder at a place where you can access it easily for instance in your documents folder. I call my folder custom-commands you can call it however you want.
Create a new notepad file inside the folder and paste the following code in it:
@echo off
set cwd=%cd%
set stripePath=C:\Path\To\Stripe\Location
cd /d %stripePath% && stripe %*
cd /d %cwd%
set cwd=
set stripePath=
Note the stripePath needs to be set to where your stripe.exe is located
This scripts tells your cmd where stripe is located.
In the windows search function search
system variables
, open the app you will be prompted with a screen that looks like this:Click
system variables
and then edit theuser path
:Add a new path:
The path needs to be the path to your newly created folder mine is called: custom-commands.
You might need to restart your computer and then just test it out by typing stripe in a cmd.
That's it! this also has one major benefit, because whenever you need something like this again you only have to create the .bat file and add your own script!
Steps:
- download the zip file
- extract to get the .exe inside it
- open cmd
- locate the file path
- try
stripe login
If you are getting an error that says: "The command stripe was not found, but does exist in the current location. If you trust this command, instead type: ".\stripe"."
Then use:
C:stripe_x_windows_64>
.\stripe login
本文标签: javascriptUsing stripe CLI to test webhooks in windows dev machineStack Overflow
版权声明:本文标题:javascript - Using stripe CLI to test webhooks in windows dev machine - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738458913a2087916.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论