I will assume you’re trying to create an endpoint location for your dev environment.
Your starting point is either the Stripe dashboard, or this: https://dashboard.stripe.com/test/webhooks/create?endpoint_location=local
1. Install the Stripe CLI
Unzip the .zip file on your Desktop to find it easier, and copy the path of the folder. It should be something like:
2. Add the `stripe` variable to your Environment variables
In your search bar, type Control Panel and go to System and Security > System > Advanced system settings. Then in the Advanced window, click Environment variables.
Go to System variables and add a new variable with the name “stripe” and the path of the folder from above.
3. Login to Stripe
Next, open the Command Prompt by typing “cmd” in your search bar. In the Command Prompt, navigate to the folder where you have the stripe.exe file (same path as above).
Once in the correct path, run
stripe login .
If you did everything correct, you should see the first line here as “Completed”.
4. Forward events to your webhook
Now, you need to go to Command Prompt again, navigate to the same folder where you have the stripe.exe file, and run the command to listen to the webhook, as shown above.
If you’re running a project at localhost:3000, replace the host with this one, and make sure the path to your webhook is the correct one.
For my project, the path is localhost:3000/api/webhook for example.
Now the second line should be marked as “Completed” too, and you should have your STRIPE_WEBHOOK_SECRET variable available in your Command Prompt window.
Paste this into the .env file of your project.
5. Trigger events with the CLI
Keep the Command Prompt open and run the last command, in the same folder like before.
Now everything should be ready.
Hope you found this useful! :)