PayPal DoDirectPayment fails with SSL if CURLOPT_SSL_VERIFYPEER is true -
using this code (pasted this tutorial), successful paypal dodirectpayment method execution. note curlopt_ssl_verifypeer set false.
however when set normal value (curlopt_ssl_verifypeer = true) no response paypal, not failure response, despite fact code operates on server working ssl certificate (all pages work https urls).
anybody knows cause problem ?
if using valid certificate , problem still exists, might need doublecheck saved ca in valid format (x.509 certificate pem). see have exported ca file called cacert.pem - create sure fle valid, , curl indeed able retrieve file (valid path etc.)
you seek export certificate 1 time again - browser (ie: firefox), can done visiting paypal https url in browser (ie: firefox) - , viewing certicate , exporting it. (make sure utilize right format stated before - x.509 certificate pem).
after saving ca pass on curlopt_cainfo param have:
curl_setopt($ch, curlopt_ssl_verifypeer, true); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt($ch, curlopt_cainfo, getcwd() . "/cacerts/builtinobjecttoken-equifaxsecureca.crt"); for more detailed explanation visit great article: http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/
quoting lastly part certficate:
if have ca certificate, not in pem format (i.e. in binary or der format isn’t base64-encoded), you’ll need utilize openssl convert pem format.
edit - if error after exporting certificate, seek save certificate using x.509 certificate pem (with chain)
ssl paypal-sandbox
No comments:
Post a Comment