Jump to content


Photo

Paypal Ipn Problem

paypal ipn unknown ssl

  • Please log in to reply
5 replies to this topic

#1 Langstra

Langstra

    Member

  • Members
  • PipPip
  • 12 posts
  • LocationNetherlands

Posted 11 December 2012 - 01:50 PM

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, 11 December 2012 - 01:52 PM.


#2 mrMarcus

mrMarcus

    I'm a beleafer.

  • Members
  • PipPipPip
  • 1,903 posts
  • LocationCanada

Posted 11 December 2012 - 02:05 PM

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?

#3 Langstra

Langstra

    Member

  • Members
  • PipPip
  • 12 posts
  • LocationNetherlands

Posted 11 December 2012 - 02:28 PM

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.

#4 mrMarcus

mrMarcus

    I'm a beleafer.

  • Members
  • PipPipPip
  • 1,903 posts
  • LocationCanada

Posted 11 December 2012 - 02:37 PM

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?  

#5 Langstra

Langstra

    Member

  • Members
  • PipPip
  • 12 posts
  • LocationNetherlands

Posted 11 December 2012 - 07:56 PM

Yes, there is probably some problem with the ssl, but I dont know. That is why I asked, Ihopeed spmebody else has this problrm before and found an answer.

#6 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 12 December 2012 - 06:17 AM

I'd ask Paypal support on this one, to be honest. Seeing as it's an HTTP error they're the ones who're best equipped to help you out.

Edited by Christian F., 12 December 2012 - 06:17 AM.

Keeping it simple.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com