Express Checkout DPaypal PHP working live but failing in sandbox

55 Views Asked by At

I'm using this library: https://github.com/amirduran/duranius-paypal-rest-api-php-library

In live mode everything is fine, but when I try to use sandbox I just get: int(35)

$requestParameters = array(
            "USER" => $this->username,
            "PWD" => $this->password,
            "SIGNATURE" => $this->apiSignature,
            "METHOD" => $method,
            "VERSION" => $this->apiVersion,
        );

        $requestParameters+=$requestData;
        $finalRequest = http_build_query($requestParameters);

        $ch = curl_init();
        $this->curl=$ch;

        $curlOptions=$this->getcURLOptions();
        $curlOptions[CURLOPT_POSTFIELDS]=$finalRequest;

        curl_setopt_array($ch, $curlOptions);
        $serverResponse = curl_exec($ch);

curl_getinfo($ch) result:

  array(26) {
  ["url"]=>
  string(37) "https://api-3t.sandbox.paypal.com/nvp"
  ["content_type"]=>
  NULL
  ["http_code"]=>
  int(0)
  ["header_size"]=>
  int(0)
  ["request_size"]=>
  int(0)
  ["filetime"]=>
  int(-1)
  ["ssl_verify_result"]=>
  int(1)
  ["redirect_count"]=>
  int(0)
  ["total_time"]=>
  float(0.228482)
  ["namelookup_time"]=>
  float(0.027594)
  ["connect_time"]=>
  float(0.175784)
  ["pretransfer_time"]=>
  float(0)
  ["size_upload"]=>
  float(0)
  ["size_download"]=>
  float(0)
  ["speed_download"]=>
  float(0)
  ["speed_upload"]=>
  float(0)
  ["download_content_length"]=>
  float(-1)
  ["upload_content_length"]=>
  float(-1)
  ["starttransfer_time"]=>
  float(0)
  ["redirect_time"]=>
  float(0)
  ["redirect_url"]=>
  string(0) ""
  ["primary_ip"]=>
  string(11) "173.0.82.83"
  ["certinfo"]=>
  array(0) {
  }
  ["primary_port"]=>
  int(443)
  ["local_ip"]=>
  string(13) "192.168.1.100"
  ["local_port"]=>
  int(53117)
}

If I just change the url to https://api-3t.paypal.com/nvp I'll get a successful or failure response. I already checked all credentials, cleaned all the cookies, logged in into real and sandbox account and I had used it some months ago without any issue.

Thank you!

1

There are 1 best solutions below

0
Cátia On

Apparently the problem was with openssl version. I solved it by installing the last version of Mamp (4.1.1) with php 7.1 on my computer and changing the version of php on the server also. Everything working now! ^.^