Jump to content

Recommended Posts

I successfully implemented paypal ipn on my website, I tested it on the paypal sandbox and everything worked. Then I changed the url from https://www.sandbox..../cgi-bin/webscr to https://www.paypal.com/cgi-bin/webscr. This should be standard procedure and everything should work fine.

Once again, when using the sandbox provided by paypal, there are no problems.

 

Now a few of my customers tried to buy things and nobody got there items. In my database I log everything and I logged this error:

http error=Unknown SSL protocol error in connection to www.paypal.com:443

 

I use paypal ipn for the payment, underneath will be the ipn.php (ipn call back script that paypal will post variables to when a payment has been done)

//Original source: https://cms.paypal.com/cms_content/US/en_US/files/developer/IPN_PHP_41.txt
//Modified sample code by Codex-m: http://www.php-developer.org
//WORKING DEMO HERE: http://www.php-developer.org/paypal_ipn_demo/
//Use your Paypal Sandbox buyer account to test.
$req = 'cmd=' . urlencode('_notify-validate');
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
//NEW CODE: using Curl instead of fsockopen
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
//curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: www.sandbox.paypal.com'));
$res = curl_exec($ch);
//assign posted variables to PHP variables
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
$account=$_POST['custom'];
$productname=$_POST['item_name'];
$txn_type=$_POST['txn_type'];
$trans_id=$_POST['transaction[0].id'];
$trans_id_2=$_POST['transaction[0].id_for_sender'];
//Check if any error occured
if(curl_errno($ch)) { //HTTP ERROR occurred
//Log error to database for troubleshooting
$log='http error='.curl_error($ch); //Here the error message gets build
db_write($log); //Here it gets written to the database
} else {
//NO HTTP ERROR OCCURRED, CLEAN
//CHECK IF VERIFIED
if (strcmp ($res, "VERIFIED") == 0) {

 

I hope somebody knows what the problem is. Additional information about my webserver:

###### ApacheFriends XAMPP version 1.7.1 ######
+ Apache 2.2.11
+ MySQL 5.1.33 (Community Server)
+ PHP 5.2.9 + PEAR (Support for PHP 4 has been discontinued)
+ XAMPP Control Version 2.5 from www.nat32.com
+ XAMPP CLI Bundle 1.3 from Carsten Wiedmann
+ XAMPP Security 1.0
+ SQLite 2.8.15
+ OpenSSL 0.9.8i
+ phpMyAdmin 3.1.3.1
+ ADOdb 5.06a
+ Mercury Mail Transport System v4.62
+ FileZilla FTP Server 0.9.31
+ Webalizer 2.01-10
+ Zend Optimizer 3.3.0
+ eAccelerator 0.9.5.3 for PHP 5.2.9 (but not activated in the php.ini)

Edited by Langstra
Link to comment
https://forums.phpfreaks.com/topic/271872-paypal-ipn-problem/
Share on other sites

Unfortunately, an "Unknown SSL protocol error in connection to www.paypal.com:443", with "Unknown" being the keyword, error is rather difficult to decipher.

 

You say "a few customers"... so not all customers, correct?  If so, then it might just be a temporary issue with Paypal.  Have you run a test purchase yourself to verify all systems are a go?

Link to comment
https://forums.phpfreaks.com/topic/271872-paypal-ipn-problem/#findComment-1398779
Share on other sites

Sorry I meant a few of my customers as in, I got 100% customers and 10% of them bought something using paypal. Every customer using it got the problem.

 

Was it spread out over a period of time?  Or was each purchase made relatively close to eachother, ie. all happened within an hour.

 

And, have you tried again since?  

Link to comment
https://forums.phpfreaks.com/topic/271872-paypal-ipn-problem/#findComment-1398784
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.