Stripe api即使使用正确版本的TLS

时间:2017-08-16 13:50:34

标签: laravel stripe-payments

我正在尝试在我的应用程序中进行付款(Laravel 5.4 + Vue在前端)但条带仍然会返回此错误:

(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工作没有问题,在线版本仍然有效,但在本地它没有。

我错过了什么?

1 个答案:

答案 0 :(得分:1)

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

  

如果收到“支持TLS 1.2”的消息,则无需进行任何更改。如果没有,请检查您正在使用的PHP库版本。如果它低于3.19.0,请更新它并再试一次。否则,请继续执行这些额外步骤。