Using stripe CLI to test webhooks in windows dev machine

✔ Recommended Answer

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

Source: stackoverflow.com

Answered By: Raiya Momin

Method #2

To use the Stripe CLI to test webhooks on a Windows dev machine in PHP, you can follow these steps:

  1. Install the Stripe PHP library: Visit the Stripe PHP library website and follow the instructions to install it on your Windows machine. You can also use a package manager like Composer to install it.

  2. Set up a webhook endpoint: Before you can test webhooks, you'll need a server endpoint to receive them. You can set up a local server on your machine, or use a cloud-based service like ngrok to create a public endpoint for testing purposes.

  3. Start the Stripe CLI: Open a command prompt or terminal window and start the Stripe CLI by running the command stripe listen --forward-to [your endpoint URL]. This will start the Stripe CLI and listen for incoming webhooks, forwarding them to your specified endpoint.

  4. Create a PHP script to handle webhooks: In your PHP project, create a file to handle webhook events. This file should listen for incoming POST requests from Stripe, verify the request using your Stripe API secret key, and then handle the event as necessary. You can find sample code for handling Stripe webhooks in PHP in the Stripe documentation.

  5. Test webhook handling: In another terminal window or command prompt, use the Stripe CLI to create test events by running the command stripe trigger [event type]. Replace [event type] with the name of the event you want to test, such as charge.succeeded or invoice.payment_failed. Check your PHP server logs or other debugging tools to confirm that your webhook endpoint is receiving and handling the test events correctly.

By following these steps, you can use the Stripe CLI to test webhooks on your Windows dev machine in PHP.

Comments

Most Popular

Remove Unicode Zero Width Space PHP

PhpStorm, return value is expected to be 'A', 'object' returned

Laravel file upload returns forbidden 403, file permission is 700 not 755