Webhooks allow Ghost to communicate between other platforms like Stripe. In order to use Stripe with a local version of Ghost you'll need to do some additional setup to allow webhook events to happen between them. The following steps show how to link a local version of Ghost with Stripe via webhook events.
If you're using Ghost(Pro), or running your theme in a production environment, you can skip this section 🤗
When developing locally and connecting Members to a Stripe account you'll need to forward all webhooks from Stripe to the local instance of Ghost. Follow the instructions on how to install and log into the Stripe CLI tool in the Stripe documentation.
Before starting a local instance of Ghost, run the following command in your CLI. Note that the localhost port number should match the one used in your local Ghost install:
stripe listen --forward-to http://localhost:2368/members/webhooks/stripe/
After running this the CLI will return a secret prefixed with
whsec_. This secret needs to be given to Ghost on start up. In a new CLI window run the following:
WEBHOOK_SECRET=whsec_1234567890abcdefg ghost start
Ghost will now be running locally with a webhooks connection to your Stripe account. Testing this can be done by using a members sign in form and signing up for a paid membership.