What is the localhost stripe webhook URL?

Using the the wasp SaaS-Template-GPT. What is the URL the stripe webhook should point to? Trying to run this on localhost for now using the stripe CLI (docker).
13 Replies
Vinny (@Wasp)
Vinny (@Wasp)2y ago
after you've set up your test product at https://dashboard.stripe.com/test/products/ go to https://dashboard.stripe.com/test/webhooks/create?endpoint_location=local and follow the instructions for downloading and testing local endpoints via the CLI. Make sure you use the url localhost:3001/stripe-webhook as Wasp runs the server on port 3001, not 4242 like they show in the stripe example
hometechdad
hometechdad2y ago
Ok, I am receiving the following error from the CLI (image). When I run wasp start it states that "Server listening on port 3001". However, when I run lsof -i @localhost it only show's localhost:3000 and not 3001. Could it be that my wasp server is actually not up? Google Auth is working fine, so I am assuming that the wasp server is up..
No description
Vinny (@Wasp)
Vinny (@Wasp)2y ago
you can quickly test it by going to localhost:3001 in your browser and you should see 'hello world'
hometechdad
hometechdad2y ago
Yep, I see 'hello world' It looks like the CLI is converting localhost to my ip. So, it is actually trying to go to <local_ip>:3001. When I try that in the browser, I get a connection refused error. However, if I go to <local_ip>:3000 the web app comes up just fine. maybe something with my PC settings... I will dig into that and report back.
MEE6
MEE62y ago
Wohooo @hometechdad, you just became a Waspeteer level 3!
Vinny (@Wasp)
Vinny (@Wasp)2y ago
hm. make sure you have one terminal open and run stripe listen --forward-to localhost:3001/stripe-webhook make sure it's running without any errors then open another separate terminal and run stripe trigger checkout.session.completed
martinsos
martinsos2y ago
Just to mention, on the Wasp side we are not doing anything smart, we just emit server on 3001 and client on 3000.
Vinny (@Wasp)
Vinny (@Wasp)2y ago
also @hometechdad make sure you are defining localhost:3001/stripe-webhook without http:// on it --> e.g. stripe listen --forward-to localhost:3001/stripe-webhook
hometechdad
hometechdad2y ago
Yep, I found the issue. Because I am using docker for the stripe cli and because I am doing this from localhost, you need to start it with a specific flag. --network='host' docker run --network="host" --rm -it stripe/stripe-cli --api-key <STRIPE_KEY> listen --for ward-to=localhost:3001/stripe-webhook Found the resolution here: https://github.com/stripe/stripe-cli/issues/427
GitHub
Webhook call filed when run stripe-cli in docker · Issue #427 · str...
Issue I run stripe-cli in docker. When event is triggered, the listener displays that new event was received, but attempt to call webhook leads to error: 2020-04-19 04:38:18 --> payment_intent.c...
hometechdad
hometechdad2y ago
It is all working now, thanks!!
Vinny (@Wasp)
Vinny (@Wasp)2y ago
ah great!
hometechdad
hometechdad2y ago
Yep, that flag is not mentioned on the stripe documentation: https://stripe.com/docs/cli/docker
martinsos
martinsos2y ago
ah uh tricky, I guess the gist is that since it is in docker, you need to tell it to use the networks host, that is what that flag does right?
Want results from more Discord servers?
Add your server