Stripe checkout not working in local development installation

Ghost version 3.27.0
OS - Windows 10
I have enabled members and connected Stripe in test mode.

When I click on the checkout button there is two error in console.

I have found this earlier topic Could not create stripe checkout session

Installed Ghost freshly and tried with Lyra theme But same issue. Stripe connection with API key ( in older version of ghost ) was working fine.

Any help? Thanks in advance.

EDIT: Complimentary Premium plan is working fine.

anybody any suggestion? I have also tried using Stripe CLI toll, as described here https://ghost.org/docs/members/webhooks/. But no luck.

Response log in Stripe dashboard

{
  "error": {
    "message": "Invalid URL: URL must be publicly accessible. Consider using a tool like the Stripe CLI to test webhooks locally: https://github.com/stripe/stripe-cli",
    "param": "url",
    "type": "invalid_request_error"
  }
}

Hi,

maybe smth went wrong or you didn’t start ghost with the webhook properly.

  1. install stripe cli (Get started with the Stripe CLI | Stripe Documentation)
    i did it via apt-get, but it’s up to you
  2. pair stripe-cli with stripe account
    $ stripe login
    you will be prompted with a pairing code and a URL
    visit the URL and allow access
  3. set your stripe-cli to listen
    stripe listen --forward-to http://localhost:2368/members/webhooks/stripe/
    you will be prompted with a webhook signing secret
  4. finally, start your ghost enviroment with your individual webhook secret
    WEBHOOK_SECRET=whsec_1234567890abcdefg ghost start

important: stripe listen has to run in it’s own terminal window, so don’t close it. Start ghost with the webhook in a new terminal window/tab instead.

Terminal window 1:

Terminal window 2:

For recurring sessions, you only need to start the stripe listen process in window 1 and start ghost with webhook in window 2. stripe login is only needed the first time.

1 Like

Thank you very much for the reply. I was following exactly same as you described but the issue was something else.
I am on Windows. The issue in not in the steps actually the issue is in the windows command prompt or my adaptation of the command in Windows environment.
If anyone face this problem in future, for them the following explanation.

When I was using the following command

WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxx ghost start

The Windows cmd was showing the following error

'WEBHOOK_SECRET' is not recognized as an internal or external command, operable program or batch file.

Then I was using the command as follows

ghost start WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxx 

Probably this was the reason.

Now the solution:
After multiple failure I have tried using git bash terminal, and the command in following structure worked.

WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxx ghost start

So If you are on windows and trying to use stripe CLI with ghost, then do one of these 2

  1. Use git bash terminal which understand linux like command
  2. Or in windows command prompt use the command in following format
set WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxx && ghost start

Good to know.

I’m using Windows 10 aswell.
You should definitely check out WSL2 (Windows Subsystem for Linux)

It’s free and can be installed on every Windows 10 Version 2004, Build 19041 or newer.
It let’s you run Linux Distributions inside windows with a full linux kernel, which should give you greater performance compared to a standard VM.
Useful if you want to run apps natively in linux, like ghost on an ubuntu distro.

1 Like