Jump to content
Sign in to follow this  
lightanother

PayPal IPN contrib problem...

Recommended Posts

Pablo,

 

Everything was running fine till this past Monday. I don't know what happend, but I am no longer getting order emails. The customer is not receiving order emails as well. I have noticed that PayPal is kicking back to the site for the paypal_notify, but no records are being written and the order stays in paypal processing status. There have been no programming updates done on the site for 3-4 weeks now. I am running OSC ver 2.2 and was running your IPN V092. I tried manually entering records in the paypalipn_tn to see if there might be a problem there. Ran some test, but did not create any new records nor any emails. I then dropped the records in both the paypalipn_tn and paypalipn_tmp_data, ran some tests and still nothing. I did upgrade tonight to IPN V095 (old checkout code) thinking that might fix the problem. Ran some more test and still nothing. It is logging the order and adding records to the paypalipn_temp_data, just no records to the paypalipn_tn.

 

website is http://www.LightAnother.com

 

Thanks,

 

Scot

Share this post


Link to post
Share on other sites

We are also having transaction failures with PayPal IPN having just switched to this contribution from Harald's implementation, being in favor of its saving the order with interim status. My customer yesterday whose transaction failed (still in PayPal Processing status) got a message from PayPal saying they had made recent changes and were experiencing difficulties.

 

Today I reviewed our seller's profile at PayPal and found that it has a place to mark whether IPN is to be enabled (the default is not enabled) and to enter the URL for the notification. So, I checked the box to enable IPN and entered the URL even though I believe we pass it with the payment request. In a while we will have the customer try his transaction again while we are all watching.

Share this post


Link to post
Share on other sites

Hi

 

First of all: Scot (from LightAnother.com) problem has been fixed. It was just a cURL problem in his server.

 

Second: zzfritz, it seems all the problem was because of PayPal's difficulties. Tell me if you still have some problems with the module

 

best regards


Pablo Pasqualino

Mar del Plata, Argentina

Share this post


Link to post
Share on other sites

Pablo,

 

Yes, everything is running good. Thank you again very much for your assistance. I have noticed a few orders that have gone through with unconfirmed shipping address, will get a fail when being sent back to the site. Is this normal or a possible bug? As soon as we accept their payment, then the order notification is sent which is fine.

 

Thanks,

 

Scot

Share this post


Link to post
Share on other sites

Hi Scot

 

When the orders have unconfirmed shipping address how do they appear in the Admin->PayPal_IPN->Transactions box?

 

If they appear as pending until you accept the payment it is ok.

 

Best regards


Pablo Pasqualino

Mar del Plata, Argentina

Share this post


Link to post
Share on other sites

Pablo,

 

They appear as paypal processing untill you go to paypal and manually accept their payment. Then it goes to pending and an email is sent out.

 

Maybe I might not have said it clearly, so I will retry. Your contri works great. It just on a unverified ship to address, OSC will give a fail when they hit continue from making a payment. So I don't know if the code being sent back is causing the fail or if a non-ipn trasaction will do the same. I haven't had a chance to test it myself on a non-ipn transaction to see if the same fail screen comes up or if a success screen comes up.

 

Thanks,

 

Scot

Share this post


Link to post
Share on other sites

Hi Scot

 

Maybe I might not have said it clearly, so I will retry. Your contri works great. It just on a unverified ship to address, OSC will give a fail when they hit continue from making a payment. So I don't know if the code being sent back is causing the fail or if a non-ipn trasaction will do the same. I haven't had a chance to test it myself on a non-ipn transaction to see if the same fail screen comes up or if a success screen comes up.

 

If the transaction has status as PENDING, when the customer hits the continue button he should see an "we are processin your order" screen... not an error... :(

 

Please check out your /catalog/checkout_success.php file to see if everythhing is ok!

 

Best regards


Pablo Pasqualino

Mar del Plata, Argentina

Share this post


Link to post
Share on other sites

Pablo,

 

Here is the source code:

 

<?php

/*

 $Id: checkout_success.php,v 1.35 2002/07/21 23:38:57 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2002 osCommerce



 Released under the GNU General Public License

*/



 require('includes/application_top.php');



 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);



 // PayPal IPN add ****************************************



 $paypalipn_query = tep_db_query("select o.orders_status,p.* from " . TABLE_ORDERS . " o LEFT JOIN paypalipn_txn p on p.item_number = o.orders_id AND o.customers_id = '" . $customer_id . "' order by o.date_purchased desc limit 1");

 $paypalipn = tep_db_fetch_array($paypalipn_query);



 if ($paypalipn['ipn_result']=='VERIFIED') {

   if ($paypalipn['payment_status']=='Completed') {

     $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_OK;

     $HEADING_TITLE = PAYPAL_HEADING_TITLE_OK;

     $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_OK;

   } else if ($paypalipn['payment_status']=='Pending') {

     $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_PENDING;

     $HEADING_TITLE = PAYPAL_HEADING_TITLE_PENDING;

     $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_PENDING;

   };

   $cart->reset(TRUE);

 } else if ($paypalipn['ipn_result']=='INVALID' || $paypalipn['orders_status']==99999) {

   $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_FAILED;

   $HEADING_TITLE = PAYPAL_HEADING_TITLE_FAILED;

   $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_FAILED;

 } else {

   $NAVBAR_TITLE_2 = NAVBAR_TITLE_2;

   $HEADING_TITLE = HEADING_TITLE;

   $TEXT_SUCCESS = TEXT_SUCCESS;

 };  



 // EOF - PayPal IPN add ****************************************



 

 $breadcrumb->add(NAVBAR_TITLE_1);

// PayPal IPN change from (blow) to (bolow it)

//  $breadcrumb->add(NAVBAR_TITLE_2);

 $breadcrumb->add($NAVBAR_TITLE_2);



 $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customer_id . "'");

 $global = tep_db_fetch_array($global_query);



 if ($global['global_product_notifications'] != '1') {

   $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . $customer_id . "' order by date_purchased desc limit 1");

   $orders = tep_db_fetch_array($orders_query);



   $products_array = array();

   $products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $orders['orders_id'] . "' order by products_name");

   while ($products = tep_db_fetch_array($products_query)) {

     $products_array[] = array('id' => $products['products_id'],

                               'text' => $products['products_name']);

   }

 }

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<?php

// BOF: WebMakers.com Changed: Header Tag Controller v1.0

// Replaced by header_tags.php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

 require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?> 

 <title><?php echo TITLE ?></title>

<?php

}

// EOF: WebMakers.com Changed: Header Tag Controller v1.0

?>

<base href="<?php echo (getenv('../../../HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="../../../stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->



<!-- body //-->

<script language="javascript1.2"><!--

EXs=screen;EXw=EXs.width;navigator.appName!="Netscape"?

EXb=EXs.colorDepth:EXb=EXs.pixelDepth;//-->

</script><script language="javascript"><!--

EXd=document;EXw?"":EXw="na";EXb?"":EXb="na";

EXd.write("<img src="http://t0.extreme-dm.com",

"/0.gif?tag=godiva11&j=y&srw="+EXw+"&srb="+EXb+"&",

"l="+escape(EXd.referrer)+"" height=1 width=1>");//-->

</script><noscript><img height=1 width=1 alt=""

src="http://t0.extreme-dm.com/0.gif?tag=godiva11&j=n"></noscript>

<table border="0" width="100%" cellspacing="3" cellpadding="3">

 <tr>

   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

   </table></td>

<!-- body_text //-->

   <td width="100%" valign="top"><form name="order" <?php echo 'action="' . tep_href_link(FILENAME_DEFAULT, 'action=notify') . '"'; ?> method="post"><table border="0" width="100%" cellspacing="0" cellpadding="0">

     <tr>

       <td><table border="0" width="100%" cellspacing="4" cellpadding="2">

         <tr>

           <td valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', $HEADING_TITLE); ?></td>

           <td valign="top" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?><div align="center" class="pageHeading"><?php echo $HEADING_TITLE; ?></div><br><?php echo $TEXT_SUCCESS; ?><br><br>

<?php

 if ($global['global_product_notifications'] != '1') {

   echo TEXT_NOTIFY_PRODUCTS . '<br><p class="productsNotifications">';

   for ($i=0; $i<sizeof($products_array); $i++) {

     echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>';

   }

   echo '</p>';

 } else {

   echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;

 }

?>

           <h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td align="right" class="main"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td align="right" class="checkoutBar">[ <?php echo CHECKOUT_BAR_DELIVERY_ADDRESS; ?> | <?php echo CHECKOUT_BAR_PAYMENT_METHOD; ?> | <?php echo CHECKOUT_BAR_CONFIRMATION; ?> | <span class="checkoutBarHighlighted"><?php echo CHECKOUT_BAR_FINISHED; ?></span> ]</td>

     </tr>

<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_BOXES . 'downloads.php'); ?>

   </table></form></td>

<!-- body_text_eof //-->

   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

   </table></td>

 </tr>

</table>

<!-- body_eof //-->



<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Everything looked good to me. The payment status from paypal wound be "unclaimed" and not pending I believe. If that is the case, then it would show failed, correct?

 

Forgive me,because I do not know php programming too well.

 

Thanks,

 

Scot

Share this post


Link to post
Share on other sites

Pablo,

 

I'm getting the same results - it always returns "Your payment has failed!". According to my logs, PayPal doesn't hit my notify_url until several minutes later.

 

When is the orders_status updated in the database? It starts out as 99999, and when the customer comes back from PayPal, checkout_success.php looks for the INVALID ipn_result or 99999 and fails if either is true. If I understand the logic, it doesn't appear that the orders_status will change unless PayPal sends the data to the notify_url.

 

Let me ask it this way: where is the orders_status supposed to changed from 99999 to "Processing"?

 

Brad

Share this post


Link to post
Share on other sites

I'm getting the same "Your payment has failed!" error. Anyone find a fix for it yet?

 

Thanks,

 

David

Share this post


Link to post
Share on other sites

Hi Scot

 

Everything looked good to me. The payment status from paypal wound be "unclaimed" and not pending I believe. If that is the case, then it would show failed, correct?

 

If the payment status from paypal is "unclaimed" it should show an PROCESSING YOUR PAYMENT screen. It should NOT show a YOUR PAYMENT HAS FAILED screen. :(

 

Can you tell me the info that appears in Admin->Paypal_IPN->Transactions about that order?

I need to know:

IPN Result

Payment Status

Pending Reason

 

Thanks


Pablo Pasqualino

Mar del Plata, Argentina

Share this post


Link to post
Share on other sites

Hi

 

Maybe those having problems with the PAYMENT FAILED page can try making this modification to the code in checkout_success.php

 

From this:

 

if ($paypalipn['ipn_result']=='VERIFIED') { 

   if ($paypalipn['payment_status']=='Completed') { 

     $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_OK; 

     $HEADING_TITLE = PAYPAL_HEADING_TITLE_OK; 

     $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_OK; 

   } else if ($paypalipn['payment_status']=='Pending') { 

     $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_PENDING; 

     $HEADING_TITLE = PAYPAL_HEADING_TITLE_PENDING; 

     $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_PENDING; 

   }; 

   $cart->reset(TRUE); 

 } else if ($paypalipn['ipn_result']=='INVALID' || $paypalipn['orders_status']==99999) { 

   $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_FAILED; 

   $HEADING_TITLE = PAYPAL_HEADING_TITLE_FAILED; 

   $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_FAILED; 

 } else { 

   $NAVBAR_TITLE_2 = NAVBAR_TITLE_2; 

   $HEADING_TITLE = HEADING_TITLE; 

   $TEXT_SUCCESS = TEXT_SUCCESS; 

 };

 

To this:

if ($paypalipn['ipn_result']=='VERIFIED') { 

   if ($paypalipn['payment_status']=='Completed') { 

     $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_OK; 

     $HEADING_TITLE = PAYPAL_HEADING_TITLE_OK; 

     $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_OK; 

   } else if ($paypalipn['payment_status']=='Pending') { 

     $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_PENDING; 

     $HEADING_TITLE = PAYPAL_HEADING_TITLE_PENDING; 

     $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_PENDING; 

   }; 

   $cart->reset(TRUE); 

 } else if ($paypalipn['ipn_result']=='INVALID') { 

   $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_FAILED; 

   $HEADING_TITLE = PAYPAL_HEADING_TITLE_FAILED; 

   $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_FAILED; 

 } else if ($paypalipn['orders_status']==99999) {

     $NAVBAR_TITLE_2 = PAYPAL_NAVBAR_TITLE_2_PENDING; 

     $HEADING_TITLE = PAYPAL_HEADING_TITLE_PENDING; 

     $TEXT_SUCCESS = PAYPAL_TEXT_SUCCESS_PENDING; 

 } else { 

   $NAVBAR_TITLE_2 = NAVBAR_TITLE_2; 

   $HEADING_TITLE = HEADING_TITLE; 

   $TEXT_SUCCESS = TEXT_SUCCESS; 

 };


Pablo Pasqualino

Mar del Plata, Argentina

Share this post


Link to post
Share on other sites

Pablo,

 

Hello and thanks for the snippit of code. I am adding it now and will test it for a little bit. Will let you know how it works on my site.

 

Thanks,

 

Scot

www.LightAnother.com - your online smoke store

Share this post


Link to post
Share on other sites

I'm getting the Payment Failed, however, when I look at both the paypal accounts the transaction has been completed. In the orders section they show as Paypal Processing, however, in Admin->Paypal_IPN->Transactions there is nothing.

 

I haven't tried osmosis's code yet though.

 

Is this happening to anyone else?

 

Thanks,

 

David

Share this post


Link to post
Share on other sites

Pablo,

 

I added the snippit of code and ran some test. Everything appears to be working now correctly. Thank you very, very much. I was getting tired of answering all of the emails about the failed payment.

 

I want to throw a little money your way for all of the hard work, updates and the personal help you have done for me. Let me know what email address I should use.

 

Thanks,

 

Scot

www.LightAnother.com - your online smoke store

Share this post


Link to post
Share on other sites

Hi Scot

 

I added the snippit of code and ran some test. Everything appears to be working now correctly. Thank you very, very much. I was getting tired of answering all of the emails about the failed payment.

 

Ok!

Tell me if it keeps working fine so that fix will be applied to the next release.

 

I want to throw a little money your way for all of the hard work, updates and the personal help you have done for me. Let me know what email address I should use

 

You are welcome! :)

Anyway, PayPal does not allow me to receive money in my account because I am from Argentina and they seem to dont like out country :(

 

Thanks anyway and any problem just write

 

best regards


Pablo Pasqualino

Mar del Plata, Argentina

Share this post


Link to post
Share on other sites
Ok!

Tell me if it keeps working fine so that fix will be applied to the next release.

 

Pablo, that fix works for me, too. And as I see it, that's the only way it can - unless PayPal responds via IPN faster than the customer can click "Continue".

 

Brad

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×