ste
ste

Reputation: 3269

Stripe api trigger a TLS error even with the right version of TLS

I'm trying to make a payment in my application (Laravel 5.4 + Vue on the front end) but stripe keeps returning this error:

(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.

The problem is that if I go to the support page and I copy and paste the script to check my TLS version:

<?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.";
}
?>

I get a "TLS 1.2 supported, no action required.". On top of that one week ago the api was working with no problem and in the online version is still working, but on local it does not.

What am I missing?

Upvotes: 1

Views: 740

Answers (1)

Catalin
Catalin

Reputation: 11

According to this, it should work if your version of Stripe PHP is greater than 3.19.0:

If you receive the message “TLS 1.2 is supported”, no changes need to be made. If not, check which version of our PHP library you are using. If it’s below 3.19.0, update it and try again. Otherwise, continue with these additional steps.

Upvotes: 1

Related Questions