stripe-cli icon indicating copy to clipboard operation
stripe-cli copied to clipboard

Local listener URL not triggering full webhook URL in Stripe CLI

Open stell opened this issue 2 years ago • 1 comments

Issue

When forwarding a local URL via Stripe CLI like this:

stripe listen --forward-to http://localhost:44383/myapp/index.php?option=app1&task=stripe_webhook --latest

in https://dashboard.stripe.com/test/webhooks i see the URL without parameters http://localhost:44383/myapp/index.php?option=app1

The task parameter is lost.

When triggering like this:

stripe trigger payment_intent.created
Setting up fixture for: payment_intent
Running fixture for: payment_intent
Trigger succeeded! Check dashboard for event details.

the listener tells:

> Ready! You are using Stripe API Version [2020-08-27]. Your webhook signing secret is ________________________________________
2022-05-06 15:31:18   --> payment_intent.created [evt___________________]
2022-05-06 15:31:18  <--  [404] POST http://localhost:44383/myapp/index.php?option=app1 [evt___________________]

I tried encoding the URL in different ways without success.

When creating the same POST call in Postman evereything works fine.

I'm using the latest CLI v1.8.11

Any ideas?

Expected Behavior

Full URL should be triggered like in POSTMAN

Environment

Windows

stell avatar May 06 '22 13:05 stell

Do you remember how you solved it? For me it's still not posting the payment_intent object like in your example

I already called support, but here's the issue in my case:

stripe listen doesn't post "payment_intent.succeeded" like the docs said it would. More detail: When I trigger this command : " stripe listen --forward-to localhost:4242/webhook " with " stripe trigger payment_intent.succeeded ", I get this output in my console instead of what the documentation at https://stripe.com/docs/payments/handling-payment-events says I SHOULD get : 2022-09-10 22:35:07 --> payment_intent.succeeded [evt_3LgcGTGNUfwSKW710i7um8W1] 2022-09-10 22:35:07 <-- [200] POST [http://localhost:4242/webhook](http://www.google.com/url?q=http%3A%2F%2Flocalhost%3A4242%2Fwebhook&sa=D&sntz=1&usg=AOvVaw0k5mKI-c4CNBxJaOwZp5S-) [evt_3LgcGTGNUfwSKW As you can see, it posts the URL but not the data we want: the "payment_intent.succeeded" . Again, basically, the stripe CLI doesn't post "payment_intent.succeeded" like the docs said it would.

:)

neonb88 avatar Sep 12 '22 17:09 neonb88

Any updates on this? I'm not receiving any request on my endpoint also

sbkobaidze avatar Jun 21 '23 20:06 sbkobaidze

I am also not receiving any requests at my endpoint with Strupe CLI. When using cURL to send a mock request, everything is working. Any help?

yash22arora avatar Aug 02 '23 18:08 yash22arora

I am on a Windows machine. What worked for me was going to

  1. Windows Defender Firewall with Advanced Security
  2. Inbound Rules (top left)
  3. Then press "New Rule..." (top right)
  4. Select Port
  5. Select TCP
  6. Select "Specific local ports". Here write down the port that you are running your server on. (3000, 30000, whatever it is)
  7. Select "Allow the connection"
  8. Leave all the rules applied
  9. Then press next and give it a name

marklidnov84 avatar Aug 24 '23 11:08 marklidnov84

Just in case any other got on my error, the command stripe listen --forward-to localhost:8888/my-webhook-endpoint must be running meanwhile execute stripe trigger [event] stripe trigger send an event to stripe listen and finally stripe listen send this request to your localhost

e1016 avatar Apr 21 '24 20:04 e1016