stripe / stripe-php

PHP library for the Stripe API.
https://stripe.com
MIT License
3.75k stars 848 forks source link

Failed to connect to api.stripe.com port 443: Connection refused #469

Closed michael-lurquin closed 6 years ago

michael-lurquin commented 6 years ago

Hello,

I currently have a problem with the connection to your API (https://api.stripe.com). I specify that I use for the moment the API with a test account.

My website is hosted by OVH (from my host) and I use your package with the Laravel framework. I opened a ticket with OVH but they say that the problem comes from your side (https://community.ovh.com/t/connexion-vers-stripe-api/8040/8).

Here is the error I get :

   Stripe\Error\ApiConnection  : Could not connect to Stripe (https://api.stripe.com/v1/plans).  Please check your internet connection and try again.  If this problem persists, you should check Stripe's service status at https://twitter.com/stripestatus, or let us know at support@stripe.com.

(Network error [errno 7]: Failed to connect to api.stripe.com port 443: Connection refused)

  at /home/mymediazaq-michael/www/vendor/stripe/stripe-php/lib/HttpClient/CurlClient.php:251
    247|         }
    248|         $msg .= " let us know at support@stripe.com.";
    249| 
    250|         $msg .= "\n\n(Network error [errno $errno]: $message)";
  > 251|         throw new Error\ApiConnection($msg);
    252|     }
    253| 
    254|     private static function caBundle()
    255|     {

  Exception trace:

  1   Stripe\HttpClient\CurlClient::handleCurlError("https://api.stripe.com/v1/plans", "Failed to connect to api.stripe.com port 443: Connection refused")
      /home/mymediazaq-michael/www/vendor/stripe/stripe-php/lib/HttpClient/CurlClient.php:213

  2   Stripe\HttpClient\CurlClient::request("get", "https://api.stripe.com/v1/plans", [])
      /home/mymediazaq-michael/www/vendor/stripe/stripe-php/lib/ApiRequestor.php:270

I know that my "api key" is sent, I saw it in the headers of the CURL request but I also noticed that the "rheaders" table was not filled !

https://github.com/stripe/stripe-php/blob/7a22499d4b8a2b25089e4efd138df59ac466478a/lib/HttpClient/CurlClient.php#L189

Which is strange, because when I do the same test on another server (in which Stripe works), I see that it is filled, is it due to that ?

Can you help me ?

Thank you

remi-stripe commented 6 years ago

@michael-lurquin This looks more like a connection issue on your server than an issue with the library itself. I'd recommend talking to your host provider (OVH) to see if the requests are maybe blocked on their end. If it was an API key issue, the error message would say so.

For any follow up questions, don't hesitate to talk to our support team here: https://support.stripe.com/email