POST request getting refused from the Stripe CLI
Opened this issue · 2 comments
The more information we have the easier it is for us to help. Feel free to remove any sections that might not apply
Issue
When attempting to trigger payment_intent.succeeded
in the Stripe CLI, the following error occurs:
After reading related discussions, including PR #621, and testing all suggested solutions, the issue persists. The error seems related to the CLI failing to connect to the localhost endpoint.
Steps Taken
- Networking Suggestions:
- Used
127.0.0.1
directly in web servers and instructed Stripe CLI to listen on127.0.0.1
. - Tried
localhost
with Stripe CLI set to listen on[::1]
(IPv6 address).
- Used
- Command Modifications:
- Explicitly added
https://
in the Stripe CLI listen command, e.g.,stripe listen --forward-to https://[::1]:3000/api/payment
.
- Explicitly added
- Endpoint Verification:
- Verified server endpoints and local listeners for correctness.
- Postman Request Test:
- Sent a
POST
request from Postman to the endpoint and received a200 OK
response.
- Sent a
Expected Behavior
When triggering payment_intent.succeeded
, the CLI should forward the event data to http://localhost:3000/api/payment
and return a response.
Steps to reproduce
- spun the docker container following the reference https://docs.stripe.com/cli/docker
- also did the necessary port mapping to expose localhost.
- SSH into the container.
- stripe login
- triggered stripe trigger payment_intent.succeeded
- got the error
Traceback
Share any debug output that was given by the CLI
Environment
- OS: Windows
- Environment: Docker Container
Additional Context
I'm relatively new to using Stripe’s CLI, though I’ve covered most basics. I've tried to resolve the issue by troubleshooting various methods and configurations, but I still seem to be missing something critical. Any additional guidance would be greatly appreciated!
Thanks for sharing @StevenKhuu27, It worked for me too! Appreciate it.