Jump to content
Sign in to follow this  
devosc

PayPal_Shopping_Cart_IPN

Recommended Posts

Bah. I found out later that my friend mistakenly went to the existing store on my site, which uses the simple paypal shopping cart, rather than to the OSC store I'm testing.

 

I'll update later after I've re-tested everything.

Share this post


Link to post
Share on other sites

I am getting very confused reading different threads - I have tried to find the problem in the forums, but the more I read, the more confused I become and I dont know what I should be doing anymore and I am too scared to continue in case I really mess something up.....please someone help me out here.

 

1. I downloaded paypal contribution 1.5 a few days ago. I installed it this evening. It seemed to install without problem. It does not show an ipn # in admin for my test order but the test order went through BUT I received several error emails from paypal.

 

Paypal Error Emails I received

 

a. PayPal IPN: Invalid Customer Transaction - 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 2, Test Test has been allowed to continue their order. Please Check Your PayPal account.

 

b. PayPal IPN: HTTP Error - An HTTP Error occured during authentication curl= socket=tcp:// domain=www.paypal.com port=80

 

c. PayPal IPN: unkown verification occurrence - Connection Type curl= socket=tcp:// domain=www.paypal.com port=80

 

d. PayPal IPN: cart - COULD NOT PROCESS: You have received a payment of 12.40 USD

 

2. I started reading the forum post at Topic 72075

and thought I was supposed to make changes as gregs post said that he missed a step and so I made the change referenced in post from January 2nd entitled:

Missed a $debug variable in /catalog/ipn.php

 

Should I have made that change ?

 

 

3. Now I read tonight (about an hour after installing 1.5 that there is a version 1.6 or 1.5a.....

 

Should I install this over the top of 1.5 ?

 

:unsure: I dont know what to do at this point..... I want to know if I should correct my item 2 above. How do I fix the paypal error messages? Once I fix the paypal error messages, will that fix my missing ipn problem?

Share this post


Link to post
Share on other sites

Deb, If you have v1.5 installed, then follow the steps in this post and upgrade to v1.5a, now in the v1.5a download (labelled v1.6 :blink: ) look in the 'connection_fix' directory, there is a text file in there that will have some code and a brief explaination of what to do in regard to your connection problems.

 

A function has both an opening '{' and closing bracket '}'.

 

Because the contrib is full debug mode, you will receive emails providing information about the transactions occuring, you only get one email from PayPal the rest are the debug emails all with Store_Name IPN in the subject line.

I would also suggest you do a test transaction with a lesser amount say $0.01.

Edited by gregbaboolal

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

Share this post


Link to post
Share on other sites

Thanks Greg,

 

I am stumbling along here. One last problem that I have tried to fix, but I guess I did it incorrectly.

 

I am getting an error after clicking 'continue

The error says:

 

Parse error: parse error, unexpected T_STRING in /usr/local/psa/home/vhosts/dogshoppe.net/httpdocs/catalog/checkout_process.php on line 102

 

A copy of my checkoutprocess.php lines 97 to 103

 

97                          'currency_value' => $order->info['currency_value'])

98                       

99      //end PayPal_Shopping_Cart_IPN

100

101

102    tep_db_perform(TABLE_ORDERS, $sql_data_array);

103    $insert_id = tep_db_insert_id();

 

What have I not done?

Share this post


Link to post
Share on other sites

you forgot to put a ' ; ' at the end of

'currency_value' => $order->info['currency_value'])

should be

'currency_value' => $order->info['currency_value']);

Also you might like to remove the PayPal_Shopping_Cart_IPN comments (which don't do anything):

 

//end PayPal_Shopping_Cart_IPN

and

//begin PayPal_Shopping_Cart_IPN

 

Then the file will be back to normal.


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

Share this post


Link to post
Share on other sites

Thank you so much Greg, for your help and your patience. I just did a completely successful order and payment. Thank you, I learned quite a few things doing this!

Share this post


Link to post
Share on other sites

I may have just missed another file upload but i tried to pay via paypal and i got the following errors when at the checkout_process.php:

 

Warning: before_process(includes/classes//paypal/ipn.php): failed to open stream: No such file or directory in /hsphere/local/home/oneathen/1athena.com/catalog/includes/modules/payment/paypal.php on line 92

 

Warning: before_process(): Failed opening 'includes/classes//paypal/ipn.php' for inclusion (include_path='.:/usr/local/lib/php') in /hsphere/local/home/oneathen/1athena.com/catalog/includes/modules/payment/paypal.php on line 92

 

Fatal error: Cannot instantiate non-existent class: paypal_ipn in /hsphere/local/home/oneathen/1athena.com/catalog/includes/modules/payment/paypal.php on line 94

 

Im combin through the files now but thought if someone was reading this who new the problem i could save tome. It's late. Thanks

Share this post


Link to post
Share on other sites

I did some more testing with v1.5a yesterday and found some strange behaviour. First of all to be sure that it is not caused by the Admin->Session settings i set all to FALSE (before i used to have 'Prevent Spider Session' and 'Recreate Session' set TRUE).

 

When not using the Auto Return Feature i could do payments without problems, got sent back to the shop via the continue button and the shopping cart was empty when i got to checkout.success.php (with ?paypal=authorized in the url). As soon as i went to another page in my shop, my cart had exactly the same item back in that i had just purchased. Beside that, everything else was fine.

 

The second problem i encountered is concernig download products. I use the Download Controller v5.3. For testing purposes, i switched the order status in the paypal module to 2 which means, i can instantly download after purchasing the item. When using the auto return feature, again, everything in connection with the orderhandling was fine. When i get redirected from the paypal website and get to chekout_success.php (with ?paypal=redirect in the url) i get a download offered, BUT, not for the item i just purchased but for the item i did purchase before the actual transaction (i ran several tests with the same customer and product). To make this a bit more clear for those who are not familiar with the download controller:

 

It is a script which gets included within checkout_success.php. It determins the order id with this MySQL query:

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

 

The fact that this query did not fetch the actual order id but the one processed prior to the actual purchase gives me the impression, that at the point when the customer arrives at checkout.success.php the current order is not yet written to the table. When i refresh the checkout_success.php page, i get the correct download offered.

This is almost driving me nuts :blink:

 

So the question is: Is it possible that the redirect is working in some way too fast? I spent more than 3 hours doing 'i don't know how many' test orders.

 

I would really appreciate your experiences running the same setup.

 

Marcus

Share this post


Link to post
Share on other sites

mattwho, the problem might be due to the double slashes:

(includes/classes//paypal/ipn.php)
In catalog/includes/modules/payment/paypal.php in the function before process.php find the include statement and remove the beginning '/' but, have you made any change in the configure.php file, because you may now always have this problem in other areas (not sure just quickly responding/thinking)?

 

marcmerz, downloads controller, if you make any change to the original catalog/checkout_process.php file you will have to make the same change in the catalog/includes/classes/paypal/cart.php in the process_transaction function which is 95% the same as the main checkout_process. just had to remove some stuff from the top that was not needed, and also a bit from the bottom which reset the cart - but it does the same process as checkout_process.php

 

your first problem is puzzling, if you look in the catalog/includes/modules/payment/paypal.php in the before process you will see that in order for the '?paypal=authorized' to appear in the url, the Customer-osC IPN has been authorized and the cart is reset and then the customer is redirected with the appended url. I will look again later....

 

I'm not totally familiar with the downloads controller, but I think it does allow you to prevent a download from occuring until a payment has been confirmed (by the storeowner?), which at present I would higly suggest, currently even if you don't use the Auto-Return feature when the customer is returned to the site their transaction is only verfied as being authentic, not whether the payment status is completed, so for example the customer could be given the download whilst their payment is still pending. Further Scripting is required here.

Also if they are automatically redirected, there is no guarantee (by PayPal) that the IPN has been immediately sent, so the customer could get back to site and the payment/order may not of been processed - but they will still be redirected with the 'paypal=redirect' in the url to checkout_sucess.php

Edited by gregbaboolal

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

Share this post


Link to post
Share on other sites

Greg,

marcmerz, downloads controller, if you make any change to the original catalog/checkout_process.php file you will have to make the same change in the catalog/includes/classes/paypal/cart.php in the process_transaction function which is 95% the same as the main checkout_process. just had to remove some stuff from the top that was not needed, and also a bit from the bottom which reset the cart - but it does the same process as checkout_process.php

 

Yes. I adjusted your catalog/includes/classes/paypal/cart.php to have the same functionality like in /catalog/checkout_process.php and i have been very careful not to interfere with your code.

 

your first problem is puzzling, if you look in the catalog/includes/modules/payment/paypal.php in the before process you will see that in order for the '?paypal=authorized' to appear in the url, the Customer-osC IPN has been authorized and the cart is reset and then the customer is redirected with the appended url. I will look again later....

 

The 'funny' thing is: The cart is reset i.e. the cart is empty when you arrive at checkout_success.php. But as soon as you go to another page in OSC, your cart carries the same item which you did just purchase again. I am quite sure that this has something to do with the settings in Admin->Sessions. Also, during all my tests i rarely checked out from my OsC account and i always used the same browser. On the other hand, a potential customer can do the same. Bottom line: It should not happen either way. TIA for looking into this.

 

I'm not totally familiar with the downloads controller, but I think it does allow you to prevent a download from occuring until a payment has been confirmed (by the storeowner?), which at present I would higly suggest, currently even if you don't use the Auto-Return feature when the customer is returned to the site their transaction is only verfied as being authentic, not whether the payment status is completed, so for example the customer could be given the download whilst their payment is still pending. Further Scripting is required here.

Also if they are automatically redirected, there is no guarantee (by PayPal) that the IPN has been immediately sent, so the customer could get back to site and the payment/order may not of been processed - but they will still be redirected with the 'paypal=redirect' in the url to checkout_sucess.php

 

(Little bit off-topic on...)

This is exactly what the download controller does, plus, you can configure the download controller with a certain order status trigger which means, when a status for an order is set higher or equal to this trigger level, you will get access to the file. Usually all orders get a status level of 1 (Pending). I configured the download controller to a status trigger level of 2. Now, whenever i set the order status code in the payment module to 2, you will have immediate access to the file. (...off topic Off)

 

I totally agree with you. I wanted to test, whether this is possible in general (to be honest i didn't even think of generating any problems by doing so). I know it is not sufficient to directly allow people access to a virtual product, because - like you said - even when you get a 'Pending' status from paypal, the payment module would set the status order level as given in the configuration which means, you would potentially allow access to something you have not received a verified payment for.

 

Marcus

Share this post


Link to post
Share on other sites

gregbaboolal, I thought so to so i fixed that but i still get the error that now looks like this:

Warning: before_process(includes/classes/paypal/ipn.php): failed to open stream: No such file or directory in /hsphere/local/home/oneathen/1athena.com/catalog/includes/modules/payment/paypal.php on line 92

 

Warning: before_process(): Failed opening 'includes/classes/paypal/ipn.php' for inclusion (include_path='.:/usr/local/lib/php') in /hsphere/local/home/oneathen/1athena.com/catalog/includes/modules/payment/paypal.php on line 92

 

Fatal error: Cannot instantiate non-existent class: paypal_ipn in /hsphere/local/home/oneathen/1athena.com/catalog/includes/modules/payment/paypal.php on line 94

 

Same thing but with only one slash.

Share this post


Link to post
Share on other sites

mattwho,

 

my line 92 looks like this:

 

include_once DIR_WS_CLASSES.'/paypal/ipn.php';

 

I just realised that it comes without the () but nevertheless, it works. I had expected that it looks like:

 

include_once (DIR_WS_CLASSES.'/paypal/ipn.php');

 

but i am no php expert and like i said the first quote is what i have in /catalog/includes/modules/payment/paypal.php.

 

Hope this helps,

Marcus

Share this post


Link to post
Share on other sites

matt,

 

Looks like there is no catalog/includes/classes/paypal/ipn.php file


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

Share this post


Link to post
Share on other sites

stupid! The directory had a capitol P so it couldn't find the file, thanks for the help. I think i have been doing this too much latley.

Share this post


Link to post
Share on other sites

Greg,

 

i hate to say this, but...

 

I did another test order with the auto return feature ON, all settings in Admin->Sessions set to FALSE. The order is processed fine, you get redirected to the checkout_success.php and your cart is empty. The next time you click on any other link, you will find that your cart is carrying the same item you just purchased.

 

Sooo.....that cart is reset in paypal.php (otherwise it wasn't empty arriving at checkout_success.php) but for some 'funny' reason it gets recreated (somewhere, somehow). Maybe it helps if i tell you, that i keep my session in MySQL.

 

grrr.... i would have bet this did only happen with one of the session settings (Admin->Sessions) being set to TRUE. And: This does not happen with Auto Return Feature set to off (both on the paypal website and in the module configuration).

 

Marcus

Share this post


Link to post
Share on other sites

I think it's most useful to optimize the contribution to work entirely off IPN and not Auto-Return or the Continue button. This has many advantages:

 

1) It's more reliable because it doesn't depend on the buyer pressing "Continue" or the Auto-Return happening and IPN retries until it's successful.

2) It doesn't require the merchant to perform any set up in the PayPal Profile.

3) Auto-Return provides no payment information.

 

The Continue Button or Auto-Return cold be utilized *optionally* for upsell or to provide a link to order status.

 

For downloadable items, it's useful to implement an email as a back-up in case the buyer isn't able to access the download immediately for some reason.


Patrick Breitenbach

Share this post


Link to post
Share on other sites

Hi pbreit,

 

I know Greg is more competent on commenting your posting but from my point of view (and knowledge), i would like to add something to your posting:

 

First of all i am really happy that you are watching this thread, getting in contact with all these people (here and in other parts of the osCommerce forum) being supportive in helping all those to build a reliable payment gateway solution (to me, this contribution discussed here already is reliable).

 

Concerning the points you mentioned (and this is what i 'know' about this contribution):

I think it's most useful to optimize the contribution to work entirely off IPN and not Auto-Return or the Continue button. This has many advantages:

 

1) It's more reliable because it doesn't depend on the buyer pressing "Continue" or the Auto-Return happening and IPN retries until it's successful.

2) It doesn't require the merchant to perform any set up in the PayPal Profile.

3) Auto-Return provides no payment information.

 

The Continue Button or Auto-Return cold be utilized *optionally* for upsell or to provide a link to order status.

Shopping_Cart_IPN_v1.5a already relies purely on the IPN method of communicating with the paypal website (at least you are able to configure it that way -> read: you can configure it not to do it that way, but who wants that to happen...).

 

That means, whatever way you choose, either with auto-return feature or not, with this contribution you are already able to purely rely on the IPN method. It doesn't matter whether a customer clicks the continue button (without auto-return) or not, the IPN is sent either way.

 

It does not matter whether you cancel the redirect using ESC or even close down the browser: As soon as the customer clicks on 'Pay' the IPN is sent.

 

I totally agree with you: The customer should not be able to interfere with the payment-transaction process (OSC-PayPal), neither intended nor unintended and this contribution is taking care of it.

 

For downloadable items, it's useful to implement an email as a back-up in case the buyer isn't able to access the download immediately for some reason.

Concerning the downloads: In my opinion it is not necessarily a task of this contribution (or a payment gateway contribution in general) to remind the customer of the fact that he may not have immediate access to his download. I use a different contribution (slightly modified) which tells the customer that a download is not available unless payment is confirmed. And it is easy to add such an information to an email the customer gets. I think this is more a general issue and does not only depend of one payment gateway solution. What might get added to this contribution in the future (and as far as i know, Greg is already thinking about it together with other ppl) is the ability to verify whether a payment is confirmed or not. To date an IPN is 'just' the transmission of order and payment details. With further scripting it is possible to analyze fields like 'payment_status' and others which might get used to assign a certain order status to the order. The order status is used by the contribution i mentioned above to decide, whether a customer gets immediate access to a download product.

 

Like Greg said in one of his first README files in his contribution: There is a lot of potential inside.

 

Like i said, i appreciate that you are watching the development closely and even offer your assistance on this matter.

 

Marcus

Share this post


Link to post
Share on other sites

the GreatZorglub, ahh that's nice to know, thanks.

 

marcmerz, thanks for that, I think we're getting there. I set the sessions to store in the database and tried a transaction, it then gave the results like you previously described. However I then cleared my cookies and cache and tried again, and it seemed fine. Before clearing the cache the IPN was being stored but because the session info wasn't being re-created it messed up the order. Try clearing your browser's cookies, I've tested twice so far with the right results.


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

Share this post


Link to post
Share on other sites

After re-testing:

 

With auto-return, everything now seems to work perfectly. I tried both Paypal account and non-Paypal account credit card transfers, for both .01 test purchases and full price purchases, and all went through without a hitch, with or without returning to the site. Fingers crossed that it stays this way...

 

Now I just have to figure out why my products with attributes aren't having their stock reduced correctly -- the total number of, say, blue shirts goes down by one when I buy a Small, but the Small quantities are not reduced. If it's not one thing, it's another...

 

Thanks for this excellent contribution and all your support efforts, Greg.

Share this post


Link to post
Share on other sites

Hi

 

Will PayPal_Shopping_Cart_IPN eliminate the paypal problem of having to click the 'click here to continue' to complete the order?

 

joe


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

Long Island, New York

Share this post


Link to post
Share on other sites

Applelinks, that is what the newest version is designed to do, and what it does perfectly for me, as you can see from the post above yours.

 

Also, I just realized that my attribute quantity problem is because I had QTPro installed -- I had already forgotten that attribute quantities was not built right into OSC (it certainly needs to be). After modifying 1.5a's cart.php to include the attribute related code, everything is working perfectly.

Share this post


Link to post
Share on other sites

How To Override Admin Session Configurations

 

1 In catalog/ipn.php:

$HTTP_POST_VARS['osCsid'] = $_POST['custom'];

define('PAYPAL_SHOPPING_CART_IPN_SESSION','true');

2 In catalog/includes/application_top.php:

// start the session

$session_started = false;

$paypal_shopping_cart_ipn_session = (PAYPAL_SHOPPING_CART_IPN_SESSION == 'true' ) ? true : false;

3 Also in catalog/includes/application_top.php override the following session checks:

Force Cookie Use

if (SESSION_FORCE_COOKIE_USE == 'True' && !$paypal_shopping_cart_ipn_session ) {

Prevent Spider Sessions

} elseif (SESSION_BLOCK_SPIDERS == 'True' && !$paypal_shopping_cart_ipn_session ) {

Check SSL Session ID

if ( ($request_type == 'SSL') && (SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($session_started == true) && !$paypal_shopping_cart_ipn_session ) {

Check User Agent

if (SESSION_CHECK_USER_AGENT == 'True' && !$paypal_shopping_cart_ipn_session ) {

Check IP Address

if (SESSION_CHECK_IP_ADDRESS == 'True' && !$paypal_shopping_cart_ipn_session ) {

The only other option in admin->configuration->sessions is Recreate Sessions but this is done in catalog/login.php so no adjustment is required.

 

Note: At the time of writing only Force Cookie Use was tested, the rest should follow in principle.


"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  

×