title: Error connecting stripe api on laravel project Stripe\Exception\ApiConnectionException
body: <p>I have to connect Stripe api to my laravel project, but when starting the process i face this  error message: <code>Unexpected error communicating with Stripe. If this problem persists, let us know at support@stripe.com. (Network error [errno 92]: HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1))</code>. I find on stackoverflow a guy with the same error and the answer was upgrading the TLS 1.0 to TLS 1.2. I tried <a href="https://support.stripe.com/questions/upgrade-your-php-integration-from-tls-1-0-to-tls-1-2" rel="nofollow noreferrer">here</a> but nothing happened. Also i run the test for  reachability <a href="https://github.com/stripe/stripe-reachability" rel="nofollow noreferrer">here</a>, and in the end a disabled HTTP/2 before making any Stripe API calls as follows <code>$curl = new \Stripe\HttpClient\CurlClient(); $curl-&gt;setEnableHttp2(false); \Stripe\ApiRequestor::setHttpClient($curl);</code>. Please i don't know what to do more.</p>
  <p>checkout.js:</p>
  <pre><code>Stripe.setPublishableKey('pk_test_51H3t5vAzmeZmoL9jwK8YCeFMxvDnuC6FsV0Rg0XvMejoZziTbS6SMQlAIkOjLj68lGqkE57Yu46jF51zg6HrnyBK00Yg8Iyy45');
  
  var $form = $('#checkout-form');
  
  $form.submit(function(event) {
      $('#charge-error').addClass('hidden');
      $form.find('button').prop('disabled', true);
  
      Stripe.card.createToken({
        number: $('#card-number').val(),
        cvc: $('#card-cvc').val(),
        exp_month: $('#card-expiry-month').val(),
        exp_year: $('#card-expiry-year').val(),
        name: $('#card-name').val()
      }, stripeResponseHandler);
      return false;
  });
  
  function stripeResponseHandler(status, response) {
      if (response.error) {
          $('#charge-error').removeClass('hidden');
          $('#charge-error').text(response.error.message);
          $form.find('button').prop('disalbed', false);
      } else {// Token was created!
  
      // Get the token ID:
          var token = response.id;
          // Insert the token into the form so it gets submitted to the server:
          $form.append($('&lt;input type=&quot;hidden&quot; name=&quot;stripeToken&quot; /&gt;').val(token));
  
          // Submit the form:
          $form.get(0).submit();
      }
  }
  </code></pre>
  <p>controller.php:</p>
  <pre><code>public function postCheckout(Request $request)
      {
          $curl = new \Stripe\HttpClient\CurlClient();
          $curl-&gt;setEnableHttp2(false);
          \Stripe\ApiRequestor::setHttpClient($curl);
  
            //require_once(&quot;vendor/autoload.php&quot;);
            //require_once(&quot;/path/to/stripe-php/init.php&quot;);
  
  
  
          if (!Session::has('cart')) {
              return redirect()-&gt;route('shoppingCart');
          }
          $oldCart = Session::get('cart');
          $cart = new Cart($oldCart);
  
  
  
          Stripe::setApiKey('sk_test_?????
  ');
          try {
              Charge::create(array(
              &quot;amount&quot; =&gt; $cart-&gt;totalPrice * 100,
              &quot;currency&quot; =&gt; &quot;usd&quot;,
              &quot;source&quot; =&gt; $request-&gt;input('stripeToken'), // obtained with Stripe.js
              &quot;description&quot; =&gt; &quot;My First Test Charge&quot;
          ));
  
         } catch (\Exeption $e) {
             return redirect()-&gt;route('checkout')-&gt;with('error', $e-&gt;getMessage());
         }
  
         Session::forget('cart');
         return redirect()-&gt;route('home')-&gt;with('succes', 'Successfully purchaised!');
      }
  
  }
  </code></pre>
  <p>checkout.blade.php:</p>
  <pre><code>&lt;span&gt;
      &lt;h4&gt;Total (USD)&lt;/h4&gt;
          &lt;/span&gt;
            &lt;strong&gt;${{ $total }}&lt;/strong&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
        &lt;div id=&quot;charge-error&quot; class=&quot;alert alert-danger {{ !Session::has('error') ? 'hidden' : '' }} &quot;&gt; {{ Session::get('error') }} 
      &lt;/div&gt;
  </code></pre>