Windows环境测试Stripe CLI时遭遇403错误求助
解决Stripe CLI登录403错误问题
我在Windows机器上测试Stripe CLI,已下载stripe.exe并添加到系统PATH。按照官方文档操作时,执行stripe login命令出现403错误,提示:
unexpected http status code: 403 We're sorry, but we're unable to serve your request.
尝试过在PowerShell执行,也用管理员权限运行cmd和PowerShell,结果一致。
更新后的错误情况
后续尝试多种方式仍持续出现403错误,具体输出如下:
C:\Users\Pourya\Downloads\stripe_1.19.1_windows_x86_64>stripe login --api-key sk_test_********* unexpected http status code: 403 We're sorry, but we're unable to serve your request. C:\Users\Pourya\Downloads\stripe_1.19.1_windows_x86_64>stripe login unexpected http status code: 403 We're sorry, but we're unable to serve your request. C:\Users\Pourya\Downloads\stripe_1.19.1_windows_x86_64>stripe login --interactive Enter your API key: Your API key is: sk_test_***********************************************************************************************BCtT How would you like to identify this device in the Stripe Dashboard? [default: DESKTOP-7NICFBT] > Done! The Stripe CLI is configured C:\Users\Pourya\Downloads\stripe_1.19.1_windows_x86_64>stripe listen --forward-to localhost:8000/payment/webhook/ A newer version of the Stripe CLI is available, please update to: v1.19.2 [Fri, 26 Jan 2024 19:00:49 CET] FATAL Error while authenticating with Stripe: Authorization failed, status=403, body={"error":{"message":"We're sorry, but we're unable to serve your request.","request_log_url":"https://dashboard.stripe.com/test/logs/req_fMX1fdY9a6XxCd?t=1706292063","type":"invalid_request_error"}}
可能的解决方法
- 更新Stripe CLI到最新版本:执行
stripe update命令,旧版本可能存在兼容性问题引发403错误。 - 排查网络环境:关闭本地防火墙、代理工具,尝试直接连接网络后重新执行命令,网络拦截是403错误的常见原因。
- 验证API密钥有效性:确认使用的*测试模式API密钥(sk_test开头)*未被禁用,且Stripe后台未设置IP白名单限制当前机器IP。
- 清理CLI本地缓存:删除路径
C:\Users\<你的用户名>\.stripe下的配置文件,之后重新用stripe login --interactive完成登录。 - 检查地区访问限制:若当前地区访问Stripe服务存在限制,可切换合规网络环境后重试。
内容的提问来源于stack exchange,提问作者Pourya Mohamadi
相关产品推荐
相关产品推荐

