When testing webhooks sent by Stripe, it's useful to redirect them to our local webhook endpoint so that we can test them locally.
Makerkit has a built-in NPM script that starts the Stripe CLI and redirects webhooks to our local endpoint.
Prerequisites
The only prerequisite is to have Docker installed and running on your machine.
Running the Stripe Webhook locally
To run the Stripe Webhook locally, run the following command:
npm run stripe:listen
The first time you run this command, it will ask you to login to your Stripe account. Follow the instructions on the screen to do so.
Once you're logged in, run the command again:
npm run stripe:listen
This time, the Stripe CLI will start and redirect webhooks to our local endpoint.
You can now test your webhooks locally when testing your Stripe integration with Makerkit 🎉