avatarAndreea Macoveiciuc

Summary

The web content provides a step-by-step guide on how to configure the Stripe CLI for Windows to create a development environment endpoint for webhooks.

Abstract

The article outlines a detailed process for setting up the Stripe Command Line Interface (CLI) on a Windows system. It begins by directing the reader to either the Stripe dashboard or a specific URL for creating a local endpoint for webhooks. The guide then proceeds through five key steps: installing the Stripe CLI by downloading the zip file from GitHub and extracting it, adding the stripe variable to the system's environment variables, logging into Stripe via the Command Prompt, forwarding events to the webhook endpoint, and finally, triggering events using the CLI. The instructions include visual aids and code snippets to assist the user in completing each step successfully. The article aims to help developers integrate Stripe webhooks into their local development environment, ensuring that the necessary configurations are in place to receive and handle Stripe events.

Opinions

  • The author assumes the reader is setting up an endpoint for a development environment, indicating a developer-focused audience.
  • The article provides a direct link to the Stripe dashboard for convenience, suggesting a user-friendly approach.
  • The inclusion of a GitHub link for the Stripe CLI download implies trust in the integrity and version control provided by GitHub.
  • By advising users to unzip the Stripe CLI to the Desktop for easier access, the author shows consideration for the user's experience.
  • The use of screenshots for visual confirmation of successful steps indicates an understanding that visual feedback can be reassuring for users during the installation process.
  • The author expresses confidence in the clarity of the instructions provided, as evidenced by the hopeful sign-off that the reader found the guide useful.

How to configure Stripe CLI for Windows

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

Go to https://stripe.com/docs/stripe-cli > Windows and follow the steps there. First, download the zip file from GitHub.

Unzip the .zip file on your Desktop to find it easier, and copy the path of the folder. It should be something like:

C:\Users\[name]\Desktop\stripe_1.17.2_windows_x86_64

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! :)

Stripe
Programming
Development
Tutorial
Women In Tech
Recommended from ReadMedium