【问题标题】:Stripe api trigger a TLS error even with the right version of TLS即使使用正确版本的 TLS,Stripe api 也会触发 TLS 错误
【发布时间】:2017-08-16 22:04:29
【问题描述】:

我正在尝试在我的应用程序中付款(前端为 Laravel 5.4 + Vue),但 stripe 不断返回此错误:

(1/1) HttpException
Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.

问题是,如果我转到支持页面并复制并粘贴脚本以检查我的 TLS 版本:

<?php
// Include stripe-php as you usually do, either with composer as shown,
// or with a direct require, as commented out.
require_once("vendor/autoload.php");
// require_once("/path/to/stripe-php/init.php");

\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
\Stripe\Stripe::$apiBase = "https://api-tls12.stripe.com";
try {
  \Stripe\Charge::all();
  echo "TLS 1.2 supported, no action required.";
} catch (\Stripe\Error\ApiConnection $e) {
  echo "TLS 1.2 is not supported. You will need to upgrade your integration.";
}
?>

我收到“支持 TLS 1.2,无需任何操作。”。最重要的是,一周前 api 可以正常工作,在线版本仍然可以正常工作,但在本地却不行。

我错过了什么?

【问题讨论】:

  • 对于你的应用程序,而不是测试,你这里使用的是官方的 Stripe lib,还是 Laravel 自带的包?您的 Laravel 应用程序是否在与普通 php 安装不同的环境中运行?如果您从应用程序中向https://www.howsmyssl.com/a/check 发出请求,结果是什么 --- TLS 1.0 还是 1.2?

标签: laravel stripe-payments


【解决方案1】:

根据this,如果您的 Stripe PHP 版本大于 3.19.0,它应该可以工作:

如果您收到“支持 TLS 1.2”的消息,则无需进行任何更改。如果没有,请检查您使用的是我们的 PHP 库的哪个版本。如果低于 3.19.0,请更新并重试。否则,请继续执行这些附加步骤。

【讨论】:

  • 应该但没有:(
猜你喜欢
  • 2017-01-19
  • 2017-01-09
  • 2016-05-13
  • 1970-01-01
  • 2022-11-29
  • 1970-01-01
  • 2020-10-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多