Jump to content
Sign in to follow this  
devosc

[Contribution]Paypal IPN - Devosc

Recommended Posts

OK, got the function replaced and things seem to be working fairly nicely now.

 

I've got two remaining questions / problems:

 

1) When you use the Test IPN Cart, and the whole transaction appears to go successfully, should you still see this at the bottom of the ipn.php page and the generated email?:

------------------------------------------------------

PayPal Response

------------------------------------------------------

INVALID

2) If I go do a test order and go all the way through manually paying at PayPal's sandbox site, I do NOT receive any IPN back, it seems.

 

The order is still "pending" and no IPN message has been received.  Do I need to set something up over at the sandbox to enable the use of IPN?  I thought the directions to this mod said I wouldn't have to do that.

Thanks!

 

-= Dave =-

 

 

Ha! Figured it out! Primary Business email wasn't listed in the sandbox, but the billing email address was. So, I just made the primary business email address match the billing email address.

 

Now simulated full purchases and payments work perfectly!

 

Thanks!

 

-= Dave= -

Share this post


Link to post
Share on other sites

I am thinking of installing Paypal on a second store. I download the Paypal tar file and get an error when winzip tries to extract it. Something about not being able to create 'Transaction Details'. I have downloaded the latest file and the one immediately prior to the latest and get the same error. My main problem is that I cant find any install instructions in either March 16 or 17th downloads.

 

What am I missing? Are they not complete? Do I need to go back another version ?

Share this post


Link to post
Share on other sites

Hi there i have sorted the problem with the order number Tempararly... but have just noted a small probelm

 

The Low order fee is not being sent (w00t). What can i do to fix this

 

 

 

Many Thnaks

 

 

Marc Turner

Aromacraft

Share this post


Link to post
Share on other sites

Hi All,

 

I've uploaded a version 3.1.5 tar.gz which has a correction in regard to ccgv and update_credit_account.

 

Also, a recent discussion has caused me to re-evaluate some code used in regard to way pages are displayed by the contribution on the stores web site, and stores having PHP < 4.3 should upgrade from previous versions of this contribution. Those using 3.1.1 and above can just copy over the catalog/includes/modules/payment/paypal directory accordingly.


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites
From what I think I can tell from the above, the only time when the product notfication checkboxes *will* be displayed, is when the customer has *not* signed up for global_notfications (this might have some bearing on what you're trying to achieve etc), and *or* if the orders_id has not been set correctly in the TABLE_ORDERS_PRODUCTS table - you would need to check.

 

Apart from that I can't see why there should be any problem. Sometimes, it is useful to echo the query string to the browser and then copy and paste the query into phpMyAdmin to see what the results are (or should be etc...).

 

Thanks for the tips; I finally had some time to look into this and found the problem. Which is, for every paypal order there are two order entries created in TABLE_ORDERS. They both have the exact same creation date, the first (unused?) one has the same modify date and the 2nd order has a modification date corresponding to the IPN arrival. The status of the first order has been set to "Processing" in all cases (even in pending, non-ipn'd, orders). Both of my other payment methods correctly only create a single order.

 

From what I can tell this seems to be because both checkout_process.php and checkout_process.inc.php create an new order entry. Since the paypal module creates it's order 2nd that order # is the one "used" to complete the order. This seems like a potentially serious problem to me; and it also explains why I continue to get orders with mismatched statuses with my admin tool, since it is finding the first order and seeing it's status set to "processing" but then not finding any status history for that order at all.

 

In the short term I have changed checkout_success to sort by last_modified instead of date_purchased which seems to solve my problem. I've double checked and can't see any mention of checkout_process in the install so I don't think I missed a step. Did I, or is this standard operation?

 

Thanks!

Share this post


Link to post
Share on other sites

I found the CartID is empyt is not registered and causing the paypal_ipn script not generate invoice ID and not insert record into database. How to solve?

Share this post


Link to post
Share on other sites

sorry for the repost i wanted to make sure when the update is done to the gccv

if it is when ipn is recived as complete or is it done when the order is ebtered in the db

in short can customer go back from paypal to shop make adjustments in the cart content and use the gc or if he loses the gc the first time he goes to paypal

thx

Share this post


Link to post
Share on other sites

I would suggest that you create a sandbox with just the MS2-2.2 and ppscipn installed (there are overwrite and run files provided). The orignal checkout_process is terminated early with an exit statement, so it is not possible to have duplicate orders as suggested above, the problem is elsewhere and since this isn't a known (common) issue, seems as if something particular is occuring in your scripts...

 

Wrong support thread.

 

Look at this post (re one of your earlier posts). Re applying credit prior to the customers departure, well this whole process is not quite adequate, but we try to work with what is there, and the reason by default that the credit is applied, is exactly to prevent what you want it to allow it do, i.e. for someone to apply the *same* credit to a new / different purchase - the train of thought here was better to safekeep from the storeowners perspective and let the customer contact you to get the funds back (reavailable)... however you can override this in paypal/catalog/checkout_process.inc.php by commenting out:

  if(is_callable(array($order_total_modules, 'apply_credit')))
   $order_total_modules->apply_credit();

 

Bad hair day....


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites
I would suggest that you create a sandbox with just the MS2-2.2 and ppscipn installed (there are overwrite and run files provided). The orignal checkout_process is terminated early with an exit statement, so it is not possible to have duplicate orders as suggested above, the problem is elsewhere and since this isn't a known (common) issue, seems as if something particular is occuring in your scripts...

 

Got the same result; I also found no way for the original checkout_process to terminate (I found no exit statement in the file... perhaps it's part of the application_top modification by paypal? Where to look?

Share this post


Link to post
Share on other sites

includes/modules/payment/paypal.php

    function before_process() {

      if(!class_exists('PayPal_osC')) include_once(DIR_WS_MODULES . 'payment/paypal/classes/osC/osC.class.php');

      if (PayPal_osC::check_order_status()) {

        tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL'));

      } else {

        include(DIR_WS_MODULES . 'payment/paypal/catalog/checkout_process.inc.php');

      }

      exit;

    }


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites
includes/modules/payment/paypal.php

Aha! OK, I know the problem then; for credit card payments via authorizenet, paymenow, and probably all others (it's a visa/mc requirement) an order # is required. this requires creating the order in the orders table "before_process" function is called. Without this it's an extra 5% (!!!) charge on each transaction.

 

To fix it on my end I just wrapped the insert in checkout_process:

	if( $order->info['payment_method'] != 'PayPal' )
{
 // BOF: WebMakers.com Added: Downloads Controller
 $sql_data_array = array('customers_id' => $customer_id,
 ... );

 tep_db_perform(TABLE_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();
}

 

See any problem with that?

 

Hopefully the next release of osC will have a clean payment pathway so all these custom mods don't have to be done :)

 

Also, thanks very much for replying and helping me locate the problem, it is greatly appreciated!

Share this post


Link to post
Share on other sites

Looks fine, you're welcome... thanks.


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites

In case anyone wonders; here is a link to the thread where the discussion on avoiding the extra charges happened and covers the mods made. Not totally relavent to this thread, but figured it might help anyone else with a similar setup.

Share this post


Link to post
Share on other sites
The problem with getting to PayPal and them telling you that this invoice has already been paid for, is because you have configured the PayPal module to synchronize invoices, this means, that osC order id is registered with PayPal and they won't let you pay again for that particular order.... So for now set this to false in you osC PayPal module config....

 

I am using the oscommerce released Paypal IPN module and am getting this issue - but cannot see where it asks about synchronize invoices.

 

Any ideas ?

 

TIA

Share this post


Link to post
Share on other sites

Hi everyone,

 

I'm using the PayPal_Shopping_Cart_IPN here by devosc. I had a customer place an order and for some reason I received 10 debug emails for it.

 

(PayPal_Shopping_Cart_IPN Debug Email Notification)

 

I looked in each one and didnt see any differences in them nor any errors. Is this normal? :huh:

 

Thanks,

 

Mark

Share this post


Link to post
Share on other sites

It all seems to be working fine - but I am getting no order emails going out - either to the customer or to the send extra order emails address i specified in OSC admin. I get the order emails fine when it is in IPN Test mode but in the none test mode it does not work with the order emails...

 

 

Help anyone please......

 

I have it set up as syncronized invoice true

Share this post


Link to post
Share on other sites

After much trouble trying to install ver 3.1.5 all of yesterday with no luck... I was contacted by a Freelancer (Alpha Ray) who offered to build a package (for a price) on a new MS2.2 set of files with the PayPal Shopping CArt IPN from devosc installed on it.. and it worked beautifully..... Great Contrib!! Much thanks to devosc and Alpha Ray

Share this post


Link to post
Share on other sites

Hi there, after quite a long setup with the 3.1.5 contribution I got it installed and funcional without any actual error scripts showing up. My only problem seems to be sending the cart to paypal. no matter what is in the cart, it is sent to paypal as zero. If i manually fill in the total while testing "aggregate cart" it sends back an ipn succesfully.

 

so the module seems to be functioning with the exception of sending the cart info.

If i send it in aggregate cart mode, it only gives me a $0 total and i have to fill it in manually. If i send it itemized, it gives me an empty cart and no option to continue manually.

 

and if i try the "update cart" or "secure checkout" buttons in itemized mode, i get his error

 

"The recipient of this shopping cart link is not an approved shopping cart user. Please review your selection and try again."

 

so it seems like i don't have permission to send them the cart totals or something

 

I am not a php programmer in the least, and am wondering if I am missing some code, or if there is a much simpler answer

 

thanks in advance

Share this post


Link to post
Share on other sites

Hi Greg and all,

 

First I would like to apologize if this have been answered before, I couldn't find the answer here in this endless thread, so if it is already available please point me to it. Thanks.

 

I just installed the v3.1.5 of the contribution (after I removed my previous v2.8) and everything seems to work normally except for 2 issues:

1) Orders placed with a gift voucher does not seem to pass the shipping cost to paypal, for example: If the ordered products cost $49USD and the shipping cost is $30USD (sub total = $79USD) and the gift voucher worth $77USD, then the total to be passed to paypal should be $2USD. However when reaching the paypal site for payment the total shows a minus number instead (as if there was no shipping cost): -$28USD

 

2) The IPN Test Panel, which worked fine on my previous v2.8 of the IPN, works strangely this time. When I use it, it sends the IPN, but the total payment "received" shows as $0 in my order and not the real sum, even if I write the correct full sum in the MC Gross and/or in the Settle Amount (tried it also).

 

Please let me know if I am doing something wrong and what's the resolution to these issues.

Thanks a lot in advance.

Share this post


Link to post
Share on other sites

Hello everyone

 

I have just upgraded to paypal ipn 3.1.5 and I am using OSCMAX V1.7 . Everything seems ok under testing in sandbox except for:

 

1. Order total carried to Paypal does not include the tax (GST). Have I missed something.

 

2. When the order has been completed (through Sandbox) the order is showing pending still and when I check on the order I get the following error:

 

 

Warning: main(/home/****/public_html/****/includes/modules/payment/paypal/classes/TransactionDetails/TransactionDetails.class.php): failed to open stream: Success in /home/****/public_html/****/includes/modules/payment/paypal/admin/TransactionSummaryLogs.inc.php on line 17

 

Fatal error: main(): Failed opening required '/home/*****/public_html/*****/includes/modules/payment/paypal/classes/TransactionDetails/TransactionDetails.class.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/*****/public_html/*****/includes/modules/payment/paypal/admin/TransactionSummaryLogs.inc.php on line 17

 

I have looked and looked but my knowledge is limited I realise that I have missed something or not put the code in correctly. Would anyone be kind enough to perhaps give me some suggestions as to where I might have gone wrong and where to look to fix it.

 

I appreciate you help

 

Regards

Trap

Share this post


Link to post
Share on other sites

I actually have a similar problem:

 

Fatal error: main(): Failed opening required

'd:/ibserver/www/.../catalog/includes/modules/payment/paypal/classes/TransactionDetails/TransactionDetails.class.php' (include_path='.;D:\IBserver\php\includes;D:\IBserver\php\pear') in d:\ibserver\www\...\catalog\includes\modules\payment\paypal\admin\TransactionSummaryLogs.inc.php on line 17

 

I followed the instructions given by the Help on the IPN Test Panel. I checked out and then stop when I got to the PayPal site. Then, I went to the store admin orders section, and click on the order I had just created, and then the error message above popped up.

 

It will be great if someone can tell me what it means and how I can get it sorted.

 

Thank you.

Edited by yfn20

Share this post


Link to post
Share on other sites
Ok, I couldn't help myself, I ran another live transaction and it still didn't work, it just says:

I saved a copy of the page that sent the details across if it would help, I'd prefer not to display it here however.

 

I can't understand why a test will work but a live transaction wont. I don't have IPN turned on in Pay Pal and auto-return is set to /checkout_success.php (and it does go there too!).

 

I've no idea what I am doing wrong here.

 

I have seen many emails that say, i have had this message where it says no paypal transaction information available with a long number ( like i am currently getting )

 

a few people say they have fixed this, yet no one has posted HOW they fixed it...

please help..

 

my cart had been working for 2 months then last month it apparently stopped working...

 

i have no clue even where to start, when i run tests in sandbox i get an email back that says unknown post... were you running any tests?

 

thanks

Share this post


Link to post
Share on other sites

Greetings everyone!

 

I have a quick question! My paypal IPN contribution so far is working great (after a couple of debugs)...

 

BUT off to a minor/major problem

 

After a customer places the order from the paypal site and then return to merchant (using paypal button)...The order history on the left column displays the images in error, meaning you get a blank picture with the big RED X.

 

I'm sure the problem lays in the order_history.php file but I can't seem to solve this one! I would appreciate anyone's help with this!!!!

 

Thank you! :thumbsup:

 

Ohh yeah here is the code just in case anyone is interested!

<?php
/*
 $Id: order_history.php,v 1.4 2003/02/10 22:31:02 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if (tep_session_is_registered('customer_id')) {
// retreive the last x products purchased
   $orders_query = tep_db_query("select distinct op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p where o.customers_id = '" . $customer_id . "' and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = '1' group by products_id order by o.date_purchased desc limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX);
   if (tep_db_num_rows($orders_query)) {
?>

<!-- customer_orders //-->
<tr>
 <td> 
   <table width="144" border="0" cellspacing="0" cellpadding="1" class="infoboxborder">
     <tr>
       <td>          <table width=100% border=0 cellpadding=0 cellspacing=0 class="infoBoxContents">
           <tr> 
             <td colspan=3 width="100%"> <img src="images/boxes/table_order_history.jpg"></td>
           </tr>
           <tr> 
             <td> 
<?php
   $info_box_contents = array();

   $product_ids = '';
     while ($orders = tep_db_fetch_array($orders_query)) {
       $product_ids .= $orders['products_id'] . ',';
     }
     $product_ids = substr($product_ids, 0, -1);

     $customer_orders_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
     $products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $product_ids . ") and language_id = '" . $languages_id . "' order by products_name");
     while ($products = tep_db_fetch_array($products_query)) {
       $customer_orders_string .= '  <tr>' .
                                  '    <td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a></td>' .
                                  '    <td class="infoBoxContents" align="right" valign="top"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $products['products_id']) . '">' . tep_image(DIR_WS_ICONS . 'button_reorder.gif', ICON_CART) . '</a></td>' .
                                  '  </tr>';
     }
     $customer_orders_string .= '</table>';

     $info_box_contents = array();
     $info_box_contents[] = array('text' => $customer_orders_string);

     new infoBox($info_box_contents);
?>
             </td>
         <tr><td align="center" class="infoboxcontent"><b><a href="account_history.php">view order history</a></b></td>
           </tr>
         </table>
       </td>
     </tr>
   </table>
 </td>
</tr>
<!-- customer_orders_eof //-->
<?php
   }
 }
?>

Edited by mirzaiaa

Share this post


Link to post
Share on other sites

how come after someone checkout by using Paypal IPN

but after that...i can c the payment by login Paypal.com

but doesn't have any record in my Admin Panel's Paypal IPN?

 

Anyone help?

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  

×