Search code examples
paypalpaypal-sandbox

Sandbox Payflow Gateway API call times out


I've followed the guide for Payflow hosted pages and tried the demo (.zip file) everything was working on a first few cURL requests. Now, the endpoint https://pilot-payflowpro.paypal.com always returns timeout:

Failed to connect to port 80: Connection timed out

This is the code that throws this error:

// run_payflow_call: Runs a Payflow API call.  $params is an associative array of
// Payflow API parameters.  Returns FALSE on failure, or an associative array of response
// parameters on success.
function run_payflow_call($params) {
  global $environment;

  $paramList = array();
  foreach($params as $index => $value) {
    $paramList[] = $index . "[" . strlen($value) . "]=" . $value;
  }

  $apiStr = implode("&", $paramList);

  // Which endpoint will we be using?
  if($environment == "pilot" || $environment == "sandbox")
    $endpoint = "https://pilot-payflowpro.paypal.com/";
  else $endpoint = "https://payflowpro.paypal.com";

  // Initialize our cURL handle.
  $curl = curl_init($endpoint);

  curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);

  // If you get connection errors, it may be necessary to uncomment
  // the following two lines:
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);

  curl_setopt($curl, CURLOPT_POST, TRUE);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $apiStr);

  $result = curl_exec($curl);
  if($result === FALSE) {
    echo curl_error($curl);
    return FALSE;
  }
  else return parse_payflow_string($result);
}

Has anyone experienced this?


Solution

  • Since you are using Host Port 80 that is most likely the cause of your connection time out. Make certain that Port 443 is open.
    Below is the information on the basic connection parameters for Payflow:

    https://developer.paypal.com/docs/classic/payflow/integration-guide/#payflow-connection-parameters

    HOSTPORT (Required) Use port 443.

    Thanks,
    Jennifer