I have developped functions to use PayPal NVP method for a website (I still use the Paypal Sandbox). All was working perfectly but since a week I can't make a request (setExpressCheckout), I have always an errcode 10054.
Here is the CURL log :
Trying 173.0.82.83...
Connected to api-3t.sandbox.paypal.com (173.0.82.83) port 443 (#0)
Cipher selection: TLSv1
successfully set certificate verify locations:
CAfile: C:\data\pem\cacert.pem
CApath: none
SSL connection using TLSv1.2 / AES256-SHA
Server certificate:
subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=PayPal Production; CN=api-3t.sandbox.paypal.com
start date: 2016-01-14 00:00:00 GMT
expire date: 2018-01-14 23:59:59 GMT
issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 Secure Server CA - G4
SSL certificate verify ok.
GET /nvp?VERSION=124.0&USER=xxxxxxxxxxxxxxxxxxxxx&PWD=xxxxxxxxxxxxx&SIGNATURE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&METHOD=SetExpressCheckout&CANCELURL=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&RETURNURL=xxxxxxxxxxxxxxxxxxxx&L_PAYMENTREQUEST_0_NAME0=Panier&L_PAYMENTREQUEST_0_NUMBER0=100&L_PAYMENTREQUEST_0_DESC0=Panier&L_PAYMENTREQUEST_0_QTY0=1&L_PAYMENTREQUEST_0_AMT0=96.20&PAYMENTREQUEST_0_PAYMENTACTION=Sale&PAYMENTREQUEST_0_AMT=96.20&PAYMENTREQUEST_0_CURRENCYCODE=EUR&DESC=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&LOCALECODE=FR&USERACTION=COMMIT&BRANDNAME=xxxxxxxxxxxxxxxx HTTP/1.1
Host: api-3t.sandbox.paypal.com
User-Agent: PayPal-PHP-SDK
Accept: */*
SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054
Closing connection 0
The SSL connection seems ok, but I have always this error.
I tried from a Windows server and a Linux server (both with Apache) with same results.
I really don't know how to solve my problem ...
Any help will be appreciated.
Regards.
PS:sorry for my bad english.
Related
Good Evening Everyone.
Have been searching for a week to try and find a way of connecting using guzzle.
curl -v https://go.paytraq.com/api/{APICall}?APIToken={APIToken}&APIKey={APIKey} \
-H "Content-Type:text/xml" \
-d "{RequestBody}"
I tried all methods and keep getting unauthorised access and not sure the best way to pass APIToken and APIKey.
I have used the above from terminal and it works fine.
$client = new \GuzzleHttp\Client(['base_uri'=>'https://go.paytraq.com']);
$request = $client->request('GET','/api/clients',['debug'=>true],[ 'headers'=>
'APIToken=XXXXXX&APIKey=XXXX'
]);
The above is the last version of my code which gives me the below error
GuzzleHttp\Exception\ClientException
Client error: GET https://go.paytraq.com/api/clients resulted in a 401 Unauthorized response: API key or token is not provided
And below is the guzzle debug
Trying 52.16.7.7:443... * Connected to go.paytraq.com (52.16.7.7) port 443 (#0) * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: /usr/local/etc/openssl#1.1/cert.pem CApath: /usr/local/etc/openssl#1.1/certs * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256 * ALPN, server did not agree to a protocol * Server certificate: * subject: CN=go.paytraq.com * start date: Oct 14 00:00:00 2019 GMT * expire date: Nov 14 12:00:00 2020 GMT * subjectAltName: host "go.paytraq.com" matched cert's "go.paytraq.com" * issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon * SSL certificate verify ok. > GET /api/clients HTTP/1.1 Host: go.paytraq.com User-Agent: GuzzleHttp/7 * Mark bundle as not supporting multiuse < HTTP/1.1 401 Unauthorized < Content-Type: text/plain; charset=utf-8 < Date: Sat, 01 Aug 2020 21:03:49 GMT < Request-Time: 1 < Server: nginx/1.4.6 (Ubuntu) < Content-Length: 32 < Connection: keep-alive < * Connection #0 to host go.paytraq.com left intact
This should work:
$client->request('GET', '/api/clients', ['query' => [
'APIToken' => $APIToken,
'APIKey' => $APIkey]
]);
I read some SO questions and answers but I can't solve my problem.
I've a cURL request:
function dmd_check_key($arg){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://***.de/dmd-pages-pro/dmd_key_generator.php?key='.$arg.'&website='.$_SERVER['HTTP_HOST'],
CURLOPT_USERAGENT => 'Codular Sample cURL Request',
CURLOPT_VERBOSE => 1
));
curl_setopt($curl, CURLOPT_STDERR, fopen("curl_debug.txt", "w+"));
$resp = curl_exec($curl);
curl_close($curl);
if(!get_option('dmd-pages-key-status')){add_option('dmd-pages-key-status', $resp);}else{update_option('dmd-pages-key-status', $resp);}
if(!get_option('dmd-pages-key')){add_option('dmd-pages-key', $arg);}else{update_option('dmd-pages-key', $arg);}
return $resp;
}
I got this errormessage:
Hostname was NOT found in DNS cache
Trying 00.13.133.000...
Connected to dimadirekt.de (00.13.133.000) port 443 (#0)
successfully set certificate verify locations:
CAfile: none CApath: /etc/ssl/certs
SSL certificate problem: unable to get local issuer certificate
Closing connection 0
Can someone explain me the errormessage and how I can resolve it?
I think the problem is the certificate. But on which server? I have two.
One server with the cURL file (nonssl) and one server which handles the data (ssl).
I try this settings:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
But it is still not working.
EDIT:
With the settings line above:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
The errormessage is gone.
Now the problem is that I don't get any response.
Now I get this response:
Hostname was NOT found in DNS cache
Trying 00.13.133.212...
Connected to ***.de (00.13.000.212) port 443 (#0)
successfully set certificate verify locations:
CAfile: none CApath: /etc/ssl/certs
SSL connection using ECDHE-RSA-AES128-GCM-SHA256
Server certificate:
subject: OU=Domain Control Validated; CN=www.***.de
start date: 2016-03-03 00:00:00 GMT
expire date: 2019-06-01 23:59:59 GMT
subjectAltName: ***.de matched
issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Domain Validation Secure Server CA
SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
GET /dmd-pages-pro/dmd_key_generator.php?key=27dda19e85378bb8df73fa3f2806a30c&website=ak.dimadirekt.com
HTTP/1.1 User-Agent: Codular Sample cURL Request Host: ***.de
Accept: /
< HTTP/1.1 200 OK < Date: Tue, 31 May 2016 11:07:49 GMT
* Server Apache is not blacklisted < Server: Apache < Vary: Accept-Encoding < Transfer-Encoding: chunked < Content-Type: text/html
<
* Connection #0 to host dimadirekt.de left intact
I am trying to get PayPal transaction history, transaction details and PayPal balance using classic PHP API with CURL. I am running cron for this. I am getting correct response but getting following error also. what can be the reason and possible way to solve it?
Hostname was NOT found in DNS cache
Trying 173.0.82.83...
Connected to api-3t.sandbox.paypal.com (173.0.82.83) port 443 (#0)
successfully set certificate verify locations:
CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
Server certificate:
subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=PayPal Production; CN=api-3t.sandbox.paypal.com
start date: 2013-08-01 00:00:00 GMT
expire date: 2015-09-18 23:59:59 GMT
issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)10; CN=VeriSign Class 3 Secure Server CA - G3
SSL certificate verify ok.
> POST /nvp HTTP/1.1
Host: api-3t.sandbox.paypal.com
Accept: */*
Content-Length: 163
Content-Type: application/x-www-form-urlencoded
upload completely sent off: 163 out of 163 bytes < HTTP/1.1 200 OK < Date: Tue, 16 Jun 2015 06:00:14 GMT
Server Apache is not blacklisted
Server: Apache
Connection: close
Content-Length: 147
< Set-Cookie:X-PP-SILOVER=name%3DSANDBOX3.API.1%26silo_version%3D880%26app%3Dappdispatcher_apit%26TIME%3D1857781589; domain=.paypal.com; path=/; Secure; HttpOnly < Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT < Content-Type: text/plain; charset=utf-8 <
* Closing connection 0
Yes, I got solution. I lowered curl version to below 7.33 and It worked for me.
A client had their server moved and the magento cron.php was never set back up. When I enabled them, I found that Magento was posting to paypal:
Cron /usr/bin/php -q /home/dev/public_html/cron.php
* About to connect() to api-3t.paypal.com port 443 (#0)
* Trying 173.0.88.69...
* connected
* Connected to api-3t.paypal.com (173.0.88.69) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using DES-CBC3-SHA
* Server certificate:
* subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=PayPal Production; CN=api-3t.paypal.com
* start date: 2013-07-03 00:00:00 GMT
* expire date: 2015-09-18 23:59:59 GMT
* subjectAltName: api-3t.paypal.com matched
* issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)10; CN=VeriSign Class 3 Secure Server CA - G3
* SSL certificate verify ok.
> POST /nvp HTTP/1.1
Host: api-3t.paypal.com
Accept: */*
Content-Length: 225
Content-Type: application/x-www-form-urlencoded
* upload completely sent off: 225 out of 225 bytes
< HTTP/1.1 200 OK
< Date: Tue, 25 Mar 2014 01:45:04 GMT
< Server: Apache
< Content-Length: 240
< Connection: close
< Content-Type: text/plain; charset=utf-8
<
* Closing connection #0
There were a bunch of these that were output from the cron job. I immediately disabled the cron.
I can’t, for the life of me, find:
1: any reason for magento to contact paypal (this is a dev server that hasn’t had a complete order since it was set up [from copy of the production server])
2: any logs in Magento or Payal that could tell me what exactly it’s posting.
Can anyone shed some light? We really need to get the cron working so we can get the sitemap generation running but I am not comfortable having it talk to Paypal for no reason.
We currently are using Paypal Payments Pro and Express Checkout
Thanks,
Mike
This is standard Magento cron job for getting reports from paypal, no worries. You are right - it's paypal_fetch_settlement_reports job. It placed in app/code/core/Mage/Paypal/etc/config.xml:
<crontab>
<jobs>
<paypal_fetch_settlement_reports>
<run>
<model>paypal/observer::fetchReports</model>
</run>
</paypal_fetch_settlement_reports>
</jobs>
</crontab>
The trouble showed itself yesterday - getting following answer from curl (called in php script by curl_exec):
$<errno>35</errno>
$<error>Unknown SSL protocol error in connection to w3s.webmoney.ru:443 </error>
That bug happens only sometimes, something around 4-5 valid responses to one invalid with 35 error. Before yesterday application was handling those requests correctly for a very long time.
Hope someone will give me a hint about possible reasons of that bug.
P.S. We are suffering from internet connection problems lately, can it be somehow connected to that bug?
Upd:
Setting verbose output to true made curl to write following log:
* About to connect() to w3s.webmoney.ru port 443 (#0)
* Trying 82.198.171.158... * connected
* Connected to w3s.webmoney.ru (82.198.171.158) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: ${path}/WebMoneyCA.crt
CApath: /etc/ssl/certs
* SSL connection using RC4-MD5
* Server certificate:
* subject: C=RU; O=WebMoney Transfer; OU=WebMoney Web Service; CN=w3s.webmoney.ru
* start date: 2010-06-07 10:03:43 GMT
* expire date: 2012-06-07 10:13:43 GMT
* common name: w3s.webmoney.ru (matched)
* issuer: OU=WM Transfer Certification Services; O=WM Transfer Ltd; CN=WebMoney Transfer Root CA
* SSL certificate verify ok.
> POST /asp/XMLPurses.asp HTTP/1.1
Host: w3s.webmoney.ru
Accept: */*
Content-Length: 281
Content-Type: application/x-www-form-urlencoded
< HTTP/1.1 200 OK
< Date: Fri, 10 Dec 2010 13:00:04 GMT
< Server: Microsoft-IIS/6.0
< X-Powered-By: ASP.NET
< Content-Length: 4423
< Content-Type: text/xml; Charset=windows-1251
< Expires: Fri, 10 Dec 2010 13:00:04 GMT
< Set-Cookie: ASPSESSIONIDQADQDTAQ=FJMNECHBENFFAADHEHPFOKAE; path=/
< Cache-control: private
<
* Connection #0 to host w3s.webmoney.ru left intact
* Closing connection #0
* About to connect() to w3s.webmoney.ru port 443 (#0)
* Trying 212.158.173.158... * connected
* Connected to w3s.webmoney.ru (212.158.173.158) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: ${path}/WebMoneyCA.crt
CApath: /etc/ssl/certs
* Unknown SSL protocol error in connection to w3s.webmoney.ru:443
* Closing connection #0
Upd:
The trouble was not on our side. The problem was hidden somewhere in w3s.webmoney.ru, in 212.158.173.158 server. I'll add more details about the bug if information will be available.
Got the following response from WM support people:
"There are four IP addresses on hostname w3s.webmoney.ru. When a request ends up on 212.158.173.158, SSL is getting killed by a piece of anti-DDoS hardware at the provider's. The problem was localized, they're now trying to fix it."