Jump to content
Sign in to follow this  
devosc

PayPal_Shopping_Cart_IPN

Recommended Posts

i had paypal ipn .0981 installed, and im fed up with it so im installing this. I have a lot of other contribs installed too, so i dont think overwriting will work, but there arent instruction about what changes were made in the code? help? thanks

Justin

 

The method I used was firstly to check which files are brand new, and just copy them straight in. Then see what files you have left and go thru them to see what differences have been added for Paypal and paste them into the existing files you have.

 

From personal experience it's not a tricky process as there's really not that much to do.

 

Cheers

Bill

Share this post


Link to post
Share on other sites

Greg,

 

Thanks a lot for looking into my problems. I have replace the code as you suggested. I also looked at the code on MY checkout button and it does, as expected, give no domain name for the checkout_process.php. I'll spend the rest of the day trying to figure out all the place I need to hard-code the full URL. If I get it to work I will post my results - I know that others have had the same issue.

 

- John

Share this post


Link to post
Share on other sites

John,

 

The quickest remedy would be just to replace that tep function with 'http://etc';


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

Share this post


Link to post
Share on other sites

I had been a bit frightened by all the email messages and stuff that I didn't understand about ipn. Anyway I just blindly went ahead and deleted everything I could find relating to paypal (I had the .98 module installed , well partly) and installed this contribution. Not forgetting to set the ipn address in the Paypal control panel (well OK I did forget and arrived at a blank screen of checkout process when I made my first test purchase). I downloaded Beyond Compare and it saved my bacon a few times while making the changes.

 

The upshot is that the next test purchase went through OK and I have set it live. Two things that didn't happen:

 

1 ) no email to the store admin as in other payment modules (but then this module sends its own so maybe that isn't needed

 

2) The order status ended up as 'Pending' despite my having set it to show up as 'Processing' in admin (Have I deleted too much stuff??)

 

Everything else seemed to run smoothly so finders crossed for the next customer who prefers to use Paypal. It looks promising so far................

Share this post


Link to post
Share on other sites

Hi David,

 

I can't spend too long, but unfortunately the dredful 0.981 thing infects a few other files other ones with the name paypal in it. I first suggest that you install a fresh copy of osC in to a different directory, then in stall my contrib, it will be in live mode by default, make a trial purchase and see the results. Now compare that to what you are getting at present. In particular account_history.php and checkout_success.php are affected by 0.981 on the catalog side.

 

Greg.


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

Share this post


Link to post
Share on other sites

Greg,

 

It works! To summarize what I've just done:

 

1) Tried a simple cash payment and got

 

1146 - Table 'whatever.TABLE_PAYPALIPN_TXN' doesn't exist

 

select o.orders_status,p.* from orders o LEFT JOIN TABLE_PAYPALIPN_TXN p

on p.item_number = o.orders_id AND o.customers_id = '5' order by

o.date_purchased desc limit 1

 

2) Realized I have a lot of problems, probably from the other IPN module, so I

took some guesses:

 

a) re-installed the original osC database

B) re-installed original account_history, checkout_success,

checkout_confirmation, checkout_payment, checkout_payment_address,

checkout_shipper, checkout_shipper_address, and checkout_success.

c) replaced checkout_process with yours

d) modified the cat/incl/pmt/paypal.php to hardcode the URL

 

3) Prayed, burned incense, and threw down some chicken bones

 

4) Tried it again and it all works!

 

Now I just need to delete hundreds of emails I got sent to myself, reverse a lot

of PayPal charges, and back it all up.

 

Next: Email myself with the orders also, not just the customers, and then figure out how I'll do taxes and UPS shipping to send that info to PayPal.

 

Thank you very, very much for your help. You have done an excellent job on this module and are a big help to a lot of us.

 

- John

Share this post


Link to post
Share on other sites

Hi Greg,

 

Since many of osC users (store owners) have installed paypalipn0.981 and/or at least many other contributions, I have a suggestion for and a request to you: provide an alternative option to install your paypal_shopping_cart_ipn without having to start with a fresh osC (stated as in your install_instruction.txt), but with your provision of both modified files (make modification notes in your instruction file) and new files (be added into osC). I believe this way will benefit many users for effective, faster, and trouble-free installation on their current osC w/o starting from a fresh osC.

 

Thank you for your consideration and help.

 

KF

Share this post


Link to post
Share on other sites

Actually when I was installing the contribution I made such a file of differences vs. the standard MS2. I'm not sure of the best way of publishing this but if anyone would like a copy just pm me.

Share this post


Link to post
Share on other sites

Thanks, David.

 

Now I feel a bit comfortable to swtich from paypalipn0.981 to this one. I would assume to do it with the followings: (please let me know if any of my assumptions are wrong...)

1. I don't have to uninstall paypalipn0.981; just go to Admin and deactivate it. (old paypal module is already deactivated in Admin.)

2. Update and/or create new tables in db.

3. Change codes in current files according to David's note.

4. Upload the changed files and new files.

5. NOT go to paypal account and change anything (settings for paypalipn0.981 remain valid).

6. Go to Admin and activate the new paypal-ipn payment module.

7. Question: By this new paypal-ipn module, when you go from your osC store to paypal secured site (by click "confirmation" button), you will not be able to alter the price amount from the URL in address bar as you can by using paypalipn0.981 (need confirmation on this. Thanks)

 

I am sure after installing this new paypal-ipn, there will be more tasks to accomplish to make it completely well functional. So, questions and need for help may come afterward, but I now need your validification on my pre-assumptions for a go first. Thanks for supporting.

 

KF

Share this post


Link to post
Share on other sites

KF,

 

1) You should first uninstall Paypal IPN 0.981 (not just deactivate it)

 

5) You should also go into your Paypal account and set the address on your website for Paypal to call (somethng like yourwebsite.com/catalog/ipn.php)

 

7) not sure but it seems to be a lot more secure than .981.....

Share this post


Link to post
Share on other sites

KoaFar,

 

I would suggest that you look at the list of the files that 0.981 changes/used and *backup* those files. I haven't loooked at all those files and don't know if code changes in those files are conditional, i.e. does the 0.981 exist, one general example would be SQL queries, that would more than like throw unavoidable error.

 

1-4 should be ok, but given the above comment you probably would have to replace the files not changed by this contrib but changed by 0.981 with the original osC ones, etc.

 

5. This contribution uses /catalog/ipn.php for PayPal to send notifications to, so you will have to change that accordingly in your PayPal profile.

 

6. When you activate this contrib there are now two PayPal email address fields, if you do not have a more than one email addr registered with PayPal, use the same in both fields, the latter one, Business Name, which is actually you Business ID according to PayPal, but when developing the contrib, I simply had a second email addr registered. At the bottom there is another field for this contrib's debug/notification email addr, this could be just the same as the primary PayPal 'Email-Address' if you wish.

 

7. Yes you are correct. Make a trial purchase.

 

If you have connection problems, i.e an HTTP error, I posted the solution earlier in this thread, also see the lengthy post on the first page for more info.

 

Happy New Year.


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

Share this post


Link to post
Share on other sites

Hi All,

 

When ready, you might like to try and further secure the /catalog/ipn.php file by restricting it's access to paypal only, this can be acheived by:

<Files ipn.php>
Order deny,allow
Deny from all
Allow from notify.paypal.com
</Files>

I quickly tested it and it did seem to work ok, the above would need to be put in your /catalog/.htaccess file.

 

Note if you're running any tests then you will need to coment out the above.

 

I suppose one could just as easily use the Apache Limit directive but I don't have time to test all possibilities.

 

Give a shout if the above is not allowing your IPNs to be registered, it should. In either case, as in the readme.txt file, you could allows rename catalog/ipn.php to something obscure and possibly not have to worry about the above suggestion, but remember to update your PayPal profile if you do.

 

you should then see an Acees Forbidden Msg when you type in that /catalog/ipn.php in your browser etc.

Edited by gregbaboolal

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

Share this post


Link to post
Share on other sites

Hi Greg,

 

I have a quesiton for your or anyone else who might be kind enough to help. I just installed the Paypal IPN contribution and everything seemed to go well except I get an error when I try to configure the Paypal module. I receive:

 

Fatal error: Call to undefined function: tep_array_shift() in /home/baku/public_html/shop/admin/includes/classes/table_block.php on line 31

 

I made sure that ALL of the files were copied to the correct location. I ran the SQL statement with no errors... What am I missing?

 

I really (REALLY) appreciate any help!

 

Heath

Share this post


Link to post
Share on other sites

Hi Heath,

 

What version of osC are you running, this contrib was specifically developed for MS2.2.

 

I looked at that particular file, and in the oscommerce-2.2ms2 version it says:

array_shift($contents);

Seems like you might be running a later snapshot version myabe.

A quick fix could be just to remove the 'tep_'.

That particular file was not altered by this contribution.

 

Greg.


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

Share this post


Link to post
Share on other sites

Hiya,

 

I am having problems with the connection to PayPal. I tried this code as you suggested in the other thread

<?php
$fp= fsockopen('tcp://www.paypal.com',80,$errno,$errstr,30);
if(!$fp) {
echo "Connection NOT working";
} else {
echo "Connection OK";
}
fclose($fp);
?>

and I get this error

Connection NOT working

Warning: fclose(): supplied argument is not a valid File-Handle resource......

So I tried replacing the line as you suggested in this post from the other thread and it works great!

Instead of $fp=fsockopen(whatever);

 

try: $fp = fopen('http://www.paypal.com','rb');

 

in your test.php file and run it again.

 

It is not clear to me what you meant by Standard-configure.php and Test-configure.php

 

If the above suggestion works you will have to edit, the catalog/classes/paypal/ipn.php and change to something like the above, because I don't have a good internet connection today, I can't test it, and give you the exact answer today. But I think the above should suffice, in the file I just mentioned look for where it says something like $port=80, immediately below you will see the fsockopen statement, change that one to fopen($domain,'rb') or it might be fopen($domain.'/cgi-bin/webscr','rb'), I'm not sure at present.

 

My question is, what do I need to put

fopen($domain,'rb')
or
fopen($domain.'/cgi-bin/webscr','rb')
??

Share this post


Link to post
Share on other sites

I just tried all three ways on test mode and I get this email for all of them

Connection Type

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

#####################

INVALID

 

what does this mean?

Share this post


Link to post
Share on other sites

John,

 

Have a look at the previous posts in 'this' thread, the solution is posted.

 

Greg.


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

Share this post


Link to post
Share on other sites

John,

 

Make sure your using v1.5, I noticed the email you had said curl is enabled, unfortunately, although that snippet of code is is in place I have yet to see it actually working, irrespective of my php version having curl enabled etc, but you might have it going on your system, it would be nice to find what's happening if so.

 

So you could try a couple things, they are probably more, but see what happens, when you remove the curl connection. I.e try to get it to use the ssl connection. If not then the tcp, if not then the solution posted in this thread with the function get_paypal_response.


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

Share this post


Link to post
Share on other sites

Greg,

 

I am using 1.5 version

 

I replaced that code in \includes\classes\paypal\ipn.php as suggested in the earlier post as I did not know how to make it use the SSL or tcp

 

and I still get an email with

Connection Type

curl= socket= domain=www.paypal.com port=

#####################

INVALID

 

none of the test orders I have been trying to do have been added to the database. Even when I try a real order nothing is added (I get as far as the paypal page with the totals and everthing but I don't have a second account to test the actual payment)

Share this post


Link to post
Share on other sites

Hi John,

 

The email, results you are now showing, look familiar, you will get an INVLAID response from paypal, because the transaction was never finalized, you need to get a friend who has PayPal account to make a trial purchase for you.

 

However try the following (copied from CA thread):

 

Set it into Test Mode and use the ipn_test.html file in the samples file to post to the /catalog/ipn.php file.

 

The best way to test is to login in as a customer, proceed to checkout via paypal but do not click the confirmation button. If you look in the url you may see the osCsid, if not view the source of the page and scroll down until you see a <form> tag, scroll across until you see the custom=1233k12h3k, highlight that what comes after the equals sign, that is the cusotmers session id. Now go back to ipn_test.html and paste that into the custom field, paste over where it says osCsid=, that bit is no longer required.

Make sure the form's action is pint to your /catalog/ipn.php file.

-The transaction numbers needs to be 17 alphanumeric characters long.

-Put something in the memo field.

-For convenience, make sure the amount in the ipn_test.html form are the same as whats in your cart (shouldn't really matter for a test, but I can't remember right now).

-Once posted you will then see a list of the info you sent.

-Now check osC admin, you should see it (order/ipn) there. Confirm by the memo.

 

I think that covers the test. Let me know.

 

yeah at present the item_name is the store name, later once purchased you would see the items listed as the item_number (don't ask me why I did it that way, might change it later.... now people are starting to ask, but question of time and patience)


"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  

×