Jump to content
Sign in to follow this  
devosc

PayPal_Shopping_Cart_IPN

Recommended Posts

Hi gregbaboolal,

 

A more interesting bit of info is that PayPal now allows you to configure your PayPal profile so that the customer is immediately returned to the shoppingcart website once they click the pay button.

Also via the account profile you are able to customize the PayPal pages alot more, i.e specific background colors etc... See PayPal for more info.

I can see from the instructions on the paypal website, that you can also send a returning website link together with the other variables which (if present) overrules the link that you specify for an immediate return to your own website. If i understand correctly, the variable has to be called 'return'. I did not find out (yet) where you send the POST data in your files and how to add this new variable. Furthermore, i do not think that this link has to be stored in the database (all other variables get stored if i understand your code).

 

Maybe you can give me a hint. Thank you very much for your wonderful contribution.

 

Regards,

Marcus

Share this post


Link to post
Share on other sites
I did not find out (yet) where you send the POST data in your files and how to add this new variable. Furthermore, i do not think that this link has to be stored in the database (all other variables get stored if i understand your code).

Concerning the 'return' variable: I think everything necessary is already in your code (/includes/modules/payment/paypal.php). The function _getPayPalFields obviuosly sends the 'return' variable because you already get redirected to your website after clicking the Continue Button after payment.

 

Now, to me this means, you can now configure your PayPal Profile to immediate return to your website after payment is made _without_ giving a link in the field of the PayPal website profil (this link is overruled by the 'return' variable that Paypal receives from us).

 

I did not test it yet but if everything works the way Paypal describes it in their infos it should work exactly like this.

 

Wait: You have to put a link in your Paypal Profile because you can not activate the immediate return without specifying a link. Nevertheless, this link is overruled by the 'return' variable.

 

Regards,

Marcus

Share this post


Link to post
Share on other sites

Is there a changes file you have that shows what chnges we have to make? Not all of us have a fresh osCommerce. it would be great help. thanks again for this contribution!

Share this post


Link to post
Share on other sites

Nevermind, I found the answer on page 4 about the differences in installation.

 

A proble I've encountered after installation is that I get duplicate orders. Of course the 2nd fails and doesn't create and IPN, but the product is bought for the 2nd time though.

 

Another thing is that in the email i receive it doesn't show my socket or port. Here's what it says:

 

Connection Type

curl=1 socket= domain=www.paypal.com port= ##################### VERIFIED

 

Anybody encounter these 2 problems and solved it?? Thanks for the awesome contribution Greg. Donations should be in place!

Share this post


Link to post
Share on other sites

Dimports,

 

I could of given you the answer by now.


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

Share this post


Link to post
Share on other sites

Has anyone else been having problems with this contrib? I have been using it since it came out without a problem one. After the PayPal change I have been having blank orders, duplications, and orders not being completed like before adding the contribution. Does anyone know what's going on? the only thing that has chnged is what ever PayPal changed on their end. Any help would be great!

 

Thanks!

 

Jeff

Edited by 35thSLP

Share this post


Link to post
Share on other sites

Hello

 

Has anyone else been having problems with this contrib? I have been using it since it came out without a problem one. After the PayPal change I have been having blank orders, duplications, and orders not being completed like before adding the contribution. Does anyone know what's going on? the only thing that has changed is what ever PayPal changed on their end.

 

YES - I do have the same problems - it normally looks like this (but not always - I guess paypal is behaving bad...)

 

1. From osc PayPal_Shopping_Cart_IPN contrib: Cornelius Hansen & Co. ApS PayPal IPN: cart

 

2. From paypal: Notification of Payment Received

 

3. From OSC with order number X: Order Process (not marked as paypal paid)

 

4. From OSC with order number X+1: Order Process (marked as paypal paid)

 

5. From paypal: Cornelius Hansen & Co. ApS PayPal IPN: Invalid Customer Transaction

 

After this process I have to delete order X manually because it's a duplicate of order X+1 except for the missing paypal "mark"

 

GREG - my admin/tools/who's online don't show the cart+content any more - could the contrib cause this? (It only a wild guess)

 

Sincerely

Cornelius


dog1.jpg Who let the dog out ?!!! Newer trust a smiling dog!

Share this post


Link to post
Share on other sites

Yes, I am having the same problems.

 

Up until they (paypal) made whatever those changes were, my store was running smoothly. Now I get an error message with every paypal payment. Also today, I received and order, was notified via email from paypal, but the order did not show up in my admin!

 

Tammy

Share this post


Link to post
Share on other sites

Yes I had a couple of blank orders from Paypal this week. One of them was an auction item that so nothing to do with oscommerce but seems to get routed through the shop anyway, and the other was a normal order that showed up blank (no customer or amount). I tried adding this info with 'edit orders' but it didn't link up with the customer history so I just deleted it.

Share this post


Link to post
Share on other sites

Hi there,

 

I'm a bit tied up elsewhere to look into this properly but I did ask PayPal about the problems, but I'm not entirely sure that the problem they addressed is exactly the same as the ones your having, I think they reffered to the when the customer returns to the site whereas yours seems to be duplicates. I would have to test the process to see, but if someone could email me their debug emails etc, it would be appreciated.

 

Incidentally PayPal did comment that at some point IPN would be the preffered way for usage with osC instead of using a return url. Again, at this time, I'm not entirely sure of it's implications, whether it will become an absolute requirement etc, but at least it assures that we are moving in the right direction etc. I will try and find out more...


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

Share this post


Link to post
Share on other sites

More specifically Im getting this error message:

 

 

"A transaction occured but PayPal did not verify it, this could be due to a communications error, but it could also be an attempted hack.

Customer 20, (name edited) has been allowed to continue their order.

Please Check Your PayPal account."

 

 

I have no idea what could be causing this.

Share this post


Link to post
Share on other sites

Tammy, this is what PayPal was talking about, when they send the customer back to the site they are not including a parameter which when osC then posts back the information is being returned as invalid (due the ommission of that parameter and it's contents), PayPal said they are fixing this.

Edited by gregbaboolal

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

Share this post


Link to post
Share on other sites
In its current form, Auto-return is problematic for this application because it doesn't supply payment information.

 

The best thing would be for OSCommerce to automatically support IPN for the database update, triggering emails, etc. IPN is very reliable, does not require the buyer to press Continue and does not require the merchant to set anything up in the PayPal account profile. By including a notify_url in the PayPal checkout button, which OSC should be able generate automatically, IPNs will be sent out.

Ryan,

 

In catalog/includes/modules/payment/paypal.php find the function _getPayPalFields() and where it retruns the $paypal_fields string the code should now look like this:

$paypal_fields .= tep_draw_hidden_field('notify_url', tep_href_link('ipn.php', '', 'SSL'));
return $paypal_fields;

This will overide the url specified in your PayPal profile.

For those without SSL should remove 'SSL' from the above. (I also think this might resolve the other issues recently reported - can someone confirm).


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

Share this post


Link to post
Share on other sites

Just to be clear NON-SSL should have: tep_href_link('ipn.php')

Also earlier on in this thread is a suggestion about protecting this the ipn.php so that only PayPal can communicate with it, this would now be recommended since the notify_url is openly displayed (if they look in the html page source).


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

Share this post


Link to post
Share on other sites

Greg

 

Thanks - my first test looks better - still two order proces e-mails - but with the same order number and only one order in ocs - great. No Invalid Customer Transaction e-mail.

 

Sincerely

Cornelius


dog1.jpg Who let the dog out ?!!! Newer trust a smiling dog!

Share this post


Link to post
Share on other sites

Greg

 

Looks ok after several tests and payments.

 

Every paypal payment from outside osc not referring to any order generate a new empty order with the amount 0. What do I have to do in order to avoid this?

 

Sincerely

Cornelius

 

PS Thanks for a great contrib. - together with ebay auction manager 1.0 it just a perfect tool if you sell on auctions.


dog1.jpg Who let the dog out ?!!! Newer trust a smiling dog!

Share this post


Link to post
Share on other sites

Cornelius, you would need to insert a line something like this in the top of catalog/ipn.php

 

if (!isset($HTTP_POST_VARS['osCsid'])) exit;

 

put this just before the include application_top.php declaration in the ipn.php file.


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

Share this post


Link to post
Share on other sites

Or alternatively if you have added in the 'notify_url' suggested earlier, you no longer need to specify an IPN url in your PayPal account profile, so you shouldn't have to worry about the above.


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

Share this post


Link to post
Share on other sites

Hello Greg

 

Thanks. I've tested both.

 

Or alternatively if you have added in the 'notify_url' suggested earlier, you no longer need to specify an IPN url in your PayPal account profile, so you shouldn't have to worry about the above.

 

Is the best because I now receive only the necessary mails: Order Process from osc and Notification of Payment Received from paypal.

 

I couldn't get the

if (!isset($HTTP_POST_VARS['osCsid'])) exit;
to work.

 

Sincerely

Cornelius


dog1.jpg Who let the dog out ?!!! Newer trust a smiling dog!

Share this post


Link to post
Share on other sites

I haven't had the time to read through this whole thread but I did make a somewhat-related post on this thread: http://forums.oscommerce.com/index.php?sho...30entry312526

 

There are at least two things that we should make sure work really well:

 

1) The usage of PayPal IPN should be automatic and OSC merchants shouldn't even have to do any set up. The inclusion of "notify_url" in the PayPal button triggers IPN. Merchants need not modify their PayPal Profiles. This would alleviate a lot of the issues I here about of OSC not learning of a payment because buyers don't press the Continue button, etc.

 

2) Shopper name, address, country, phone and email should be transmitted to PayPal so that it need not be entered again. This is really easy to do.

 

I'm happy to get involved as much as I can. I can read code but not write it so well!


Patrick Breitenbach

Share this post


Link to post
Share on other sites

Hi Greg - Great module, I must say.

 

I seem to have a problem with transactions in Canadian dollars. If I check "Selected Currency", normally the transaction should go through in Canadian Dollars, the only available currency on my osC. But when I get to the PayPal screen, the currency is in U.S. !!! No changes to the amount.

 

I have made a modification to the paypal.php file this way, just for fun:

 

function process_button() {

global $order, $currencies, $currency;

 

if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') {

$my_currency = $currency;

} else {

$my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5);

}

if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) {

$my_currency = 'CAD';

}

return $this->_getPayPalFields($order, $currencies,$my_currency);

}

 

 

Well, that seems to work, EXCEPT: On the paypal screen, there is no amount in the "Total Amount" field!

 

And when I try to check method 2, I get the "white screen of death" from paypal.

 

Any idea?

Share this post


Link to post
Share on other sites

One thing I notice with your above code is that you are forcing the CAD when the $my_currency is not one of the currencies in the array list, if at all should be forcing it within the first if statement.

 

Email me a link to your site, also let me know what your default currency is and what the selected currency etc is (from the paypal config section).

 

I would suggest that you put it back to the way it was and view the source just before hitting 'your' continue button, also printing some of the values to screen if not shown in the source.

 

Also, I am assuming that you have your PayPal account profile currency settings configured correctly to accept CAD.


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

Share this post


Link to post
Share on other sites

I'm lost-

 

If I add this code into catalog/includes/modules/payment/paypal.php

 

$paypal_fields .= tep_draw_hidden_field('notify_url', tep_href_link('ipn.php', '', 'SSL'));

return $paypal_fields;

 

What will happen?

 

What code should it replace (from the instructions on page 19, it looks like it's supposed to replace about 70 lines of code, which doesn't make sense). Is it just added in without replacement?


Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Share this post


Link to post
Share on other sites

dj,

 

it does not replace the whole code, you just need to insert

 

$paypal_fields .= tep_draw_hidden_field('notify_url', tep_href_link('ipn.php', '', 'SSL'));

 

just above

 

return $paypal_fields;

 

This means you no longer have to specify the IPN url in your PayPal account profile.


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

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×