Jump to content
Sign in to follow this  
devosc

[Contribution]Paypal IPN - Devosc

Recommended Posts

oh ok, what you could do is put that section that deals with the email into a file called email order_confirmation.inc.php and put in the catalog/includes/modules/directory.

Then include it in the relevant sections in both catalog/checkout_process.php and catalog/includes/modules/payment/paypal/checkout_update.php, for the latter it should be familiar to you as it is exactly the same as the script occuring in catalog/checkout_process.php with 2 exceptions, $insert_id == $orders_id and [ii] $order->customer['customer_name'] == ($order->customer['firstname'] .  ' ' . $order->customer['lastname'] ), so a little work around for these two cases would be required.

Hello again. I thought I had fixed the problem but appearently not. This is what is happening: in the email I am sending to customers, the php file creating it is supposed to do two things: create a unique code based off of the product ID that comes from the product they purchase and add it to a database so it is usable. I have done exactly what you have said to do and it doesn't work. The email is sent after IPN confirms that the payment has been made, but the unique number is never created. It's as if it can't draw the order information to make the code. This is where it gets interesting: if I purchase though an option like Cash on Delivery, it works perfectly fine. The code is created perfectly and everything works. This is very confusing. Can anybody help?

 

To kind of show what I'm talking about, here are copies of the emails I get. The first is through CoD, and the last is through Paypal:

 

Hello, you have just purchased from Servershots.

 

Those are the unique codes for your products

 

87ybnf863 - Unreal Tournament 2004 Generic 3

 

If this is the first time you have bought a Servershot, you have to register on www.servershots.com/ssuser/register . After that you will have an

account, accessible at www.servershots.com/ssuser/ ,where you can set up your Servershots.

Now, if you have an account, please type the unique code that you just received at the section Add a new ServerShot. In order to set up your ServerShot,

you have to follow the instructions from there.

 

Now for the Paypal email:

 

Hello, you have just purchased from Servershots.

 

Those are the unique codes for your products

 

 

If this is the first time you have bought a Servershot, you have to register on www.servershots.com/ssuser/register . After that you will have an

account, accessible at www.servershots.com/ssuser/ ,where you can set up your Servershots.

Now, if you have an account, please type the unique code that you just received at the section Add a new ServerShot. In order to set up your ServerShot,

you have to follow the instructions from there.

 

Now I purchased the exact same product both times. I don't understand why it doesn't work. :(

Share this post


Link to post
Share on other sites

I just installed this contribution and I was wondering, how does it get the IPNs if I didn't give it a password for the email account?

 

 

Eric

Share this post


Link to post
Share on other sites

Eric, I'll take a stab at being useful here. The shortest answer is: no password needed. The reason is the IPN feedback URL is specified inside the transaction (along with order amount, payee, etc.). You don't need to set the IPN URL in your PayPal profile.

 

Greg Baboolal's module conveys users to PayPal for the purpose of paying you. When this handover of your customer happens, Greg's software passes instructions for the IPN notification to close the loop. No password needed because no secrets are given away. Greg's software is essentially telling the PayPal servers "Here's a guy wanting to pay eric@company.com $xx.xx. If the guy really does pay, please confirm by posting to URL blahblah/ipn.php". The URL is strategically designed by Greg to trigger order confirmation in osCommerce: going to the "Pending" status. The only information "leaked" by PayPal about your account is the single bit that your customer paid up.

 

For the technical answer to your question, search Greg's code for "notify_url". That's the XML variable set in catalog/includes/modules/payment/paypal.php.

Edited by Bob Stein, VisiBone

Share this post


Link to post
Share on other sites
The email is sent after IPN confirms that the payment has been made, but the unique number is never created. It's as if it can't draw the order information to make the code. This is where it gets interesting: if I purchase through an option like Cash on Delivery, it works perfectly fine. The code is created perfectly and everything works.

Ben - it seems like you and I are having similar problems with different applications. My problem involves invoking a file to dump all the transaction information to a text file everytime an IPN is issued. I put the necessary include statement for my file inside of checkout_update.php. However, it seems that, at that point, I can't access the order information anymore. I CAN access the customer's info, but just not what they ordered.

 

I've been playing around with this today, and have been trying to figure out how to get the order id, which I assume is stored in $order_id. However, I'm having trouble figuring out how to get that variable for the order. The way my file works is that it takes a look at the shopping cart when it is invoked and writes everything that is in the shopping cart to the text file. However, it seems that when checkout_process.php is invoked, the shopping cart is no longer relative. Therefore, that would explain (at least for me) why it works fine for Money Order purchases (or COD in your case), but not for Paypal.

 

So, I'm stuck at this point. My thinking was that if I could somehow get the $order_id, then I could just go into the database and retrieve all the information for the order, which should also work in your case. However, I'm just having trouble getting there.

 

It seems like accessing order information upon IPN receipt would be helpful for many different applications in others' osCommerce stores, so maybe Greg et al. will have some useful insight as to how we can solve this problem...

Share this post


Link to post
Share on other sites

Guys,

 

I've been using osCommerce for a couple years, and recently upgraded my previous IPN solution to this one.

 

Now, I'm getting the "stuck in paypal processing bug", which is directly related to some sort of bug in ipn.php that's causing it to throw back HTTP ERROR 204s (No Content).

 

As shown here:

 

216.113.188.202 - - [28/Jun/2004:17:33:15 -0700] "POST /ipn.php HTTP/1.0" 200 0 "-" "-"

216.113.188.202 - - [28/Jun/2004:20:52:21 -0700] "POST /ipn.php HTTP/1.0" 200 0 "-" "-"

216.113.188.202 - - [28/Jun/2004:21:05:55 -0700] "POST /ipn.php HTTP/1.0" 204 0 "-" "-"

216.113.188.202 - - [30/Jun/2004:11:10:31 -0700] "POST /ipn.php HTTP/1.0" 204 0 "-" "-"

 

You'll see that we had two successful (code 200) transactions, followed by two unsuccessful (code 204) transactions. Paypal attempted to give us an IPN on those four occasions, and two of them "broke" on our side, generating no response and not updating the order, and leaving nothing in the error log to go by.

 

Note that in both of the 204 cases, the paypal payment was successful, and the order never got entered into our system, as it was stuck in "paypal processing". This caused both of those buyers to have orders that we never got, yet they paid for them.

 

This also left us unable to "force" the generation of an order email without modifying the code, which was frustrating. This module, considering that it relies on third-party servers (paypal) talking to code on our end, should definitely have a "Something went awry, force this order to finish processing" button that can be activated from the admin interface.

 

If anyone else has had the 204 problem and has a solution that will keep it from happening in the future, I'd like to hear it. I've had 3 204 errors in the past 7 days leading to orders being paid for and not generating emails or moving to the processing stage.

 

Thanks,

 

-Matt

Share this post


Link to post
Share on other sites

Can someone help me? I am in the process of installing the newest version of this IPN, on the newest version of osc.

I am in the part of the instructions where you edit catalog/checkout_success.php.

The instructions say to replace this:

tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
}

with this:

//begin PayPal_Shopping_Cart_IPN
    tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
  } else if ((isset($HTTP_GET_VARS['action']) && $HTTP_GET_VARS['action'] == 'success')) {
    paypal_reset_checkout_cart_session();
  }
//end PayPal_Shopping_Cart_IPN

But that section has already been modified (I added the purchase without account mod), so it currently looks like this:

//    tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
// Added a check for a Guest checkout and cleared the session - 030411 
if (tep_session_is_registered('noaccount')) { 
tep_session_destroy(); 
tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL')); 
}

 

How should I proceed? I know I probably don't want to overwrite the pwa stuff. I just don't know where to add in the new paypal code.

Edited by wickeddivine

Share this post


Link to post
Share on other sites
If anyone else has had the 204 problem and has a solution that will keep it from happening in the future, I'd like to hear it. I've had 3 204 errors in the past 7 days leading to orders being paid for and not generating emails or moving to the processing stage.

...make that 8 times since June 24th, amounting to around $200 in sales-that-were-paid-for-but-never-got-to-the-processing-stage.

 

Ouch. :)

 

Anyone who has ideas on what would cause ipn.php to throw up 204s intermittently, I'd like to hear them...my cart is live and I'm going to hold off on extensive code debugging until I hear if anyone else has dealt with this before and has a simple solution.

 

Thanks,

 

-Matt

Share this post


Link to post
Share on other sites

I now see that the dienice routine throws up 204 when the authenticate routine fails. Obviously there's any number of reasons this could happen intermittently.

 

Anyone have any common issues with the authenticate routine that can be worked around? I'm considering increasing the CURL timeout, but for some reason I doubt that's the problem. I'm about to flip on debugging and try to catch the bug in the act again, but if someone's already been through this, I'd like to hear it. :)

 

Thanks,

 

-Matt

Share this post


Link to post
Share on other sites

not much time, but the easiest thing to do is to change the 204 No Content response to a 500 Error respon$e.


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

Share this post


Link to post
Share on other sites
not much time, but the easiest thing to do is to change the 204 No Content response to a 500 Error respon$e.

Will that make paypal re-try the IPN later? Otherwise it's not much use as the problem would still occur, it would just be a different error code in the logs.

 

Also, what's the deal with the authenticate routine? What are the most common reasons it fails that aren't obvious things like timeout issues? Are there sometimes Paypal processing delays that can cause the authentication to fail for a seemingly legitimate reason? Anything subtle like that?

 

A temporary solution would be to rename ipn.php to something non-obvious that only paypal would know about, then dropping the authenticate routine altogether until the bug is fixed. Obviously that's a lot less secure (and isn't good practice) than fixing the actual problem, and I tend to avoid those types of solutions...

 

Anyone else having this specific problem? I know I've seen some chatter about it along the thread at some point, but not to this level of detail.

 

-Matt

Share this post


Link to post
Share on other sites
Will that make paypal re-try the IPN later?
Yes.

Actually I've tried to ask PayPal about this but so far have had not had a response. It should be easier enough to have a button on the PayPal site where you could resend the IPN, this said because one would of thought by logging all IPNs that this can be subject to abuse from the store owner's point of view.

You could rename the IPN file and configure your paypal account accordingly, however this won't work (effeciently) if having multiple stores or types of transactions, hence the notify-url is included spefic to that store's transactions, and also in doing so does not require any configuration of the paypal profile.


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

Share this post


Link to post
Share on other sites
Still no IPN and getting a blank test page. Searched through the forum and seems a lot of people have this problem. I tried every piece of advice I could find and still can't get it work. Then spent over an hour in PayPal's site viewing IPN tech notes (and I learned a lot).

 

Now I have a stupid question.... in PayPal (not oscommerce) when you set up the IPN and have to give a URL, what URL do you give? Your domain name, a specific page from the oscommerce catalog? Hoping it's something that simple to fix this.

 

I don't know what else to try. I haven't even gotten started on trying to get the files people purchase to download for them. 3 months working on this thing to set it up. I feel like a 5-yr-old in high school trying to do algebra while my brain will only take in 1+1. I'm not totally illiterate, just new to php and mysql and oscommerce. I'd do straight html PayPal (like I have been for 2 yrs) but I need my customers to be able to download their purchases without me having to intervene for every purchase. :huh:

 

Please, please, take pity on me and offer advice if any of you have overcome this little obstacle. I have a lovely horizontal bruise from banging my head against my desk for so long. :blink:

bumping for advice. I'm still stuck on this IPN problem.

Share this post


Link to post
Share on other sites

IPN retries until it is successful. Our server looks for a "2xx" response from your web server (e.g., "200 OK"). Make sure you aren't catching errors and returning a page wth a 200 response. 500 errors should be returned if you want the IPN server to retry.


Patrick Breitenbach

Share this post


Link to post
Share on other sites

Hi,

 

I'm trying (rather desperately) to get the IPN module to work with eBay IPN's. A simple statement could work:

 

if ($_POST['for_auction'] == 'true') {
 //  code to insert into a separate ebay IPN table, or better yet,
 //  run a separate IPN script just for eBay orders altogether...
}

 

but I have no idea where to insert the conditional (or if that would even be the correct conditional to use). Anybody else know of any solutions to this problem? I'm sure there are others selling with OSC and eBay who would appreciate the advice too.

 

Thanks in advance for any help!

Share this post


Link to post
Share on other sites

Hi there. I am also getting some 204 problems. See from my log:

 

64.4.241.140 - - [23/May/2004:19:19:47 +0200] "POST /ipn.php HTTP/1.0" 200 0
216.113.188.202 - - [17/Jun/2004:16:36:37 +0200] "POST /ipn.php HTTP/1.0" 204 0 "-" "-"
216.113.188.202 - - [18/Jun/2004:16:12:43 +0200] "POST /ipn.php HTTP/1.0" 204 0 "-" "-"

 

And, in addition, I have another PayPal funded payment that does not show up in my IPN page. Seems to me like it started to "fail" after they moved the IPN server over to the eBay IP pool range. At least this is the case for me. I see that from earlier posts here, the same server IP succeeds and fails..

 

Can anyone tell me how to change the 204 to show a 500 error instead? I am on a webhotel, so I do not have access to the Apache configuration.

 

I also moved from one server to another recently (june 28), but the "fault" is still there.

 

PayPal IS sending me email telling me about the purchase, so I don't miss out on them, but it would be nice to see the IPN work as supposed again...

 

Rune

WaveBrazil

Share this post


Link to post
Share on other sites

Hello,

 

I just installed the PayPal IPN v2.4. I am working on the "test" environment and put a few "test" orders through. However, when I click on the admin link to test the IPN and then open the orders, the information such as PayPal ID, etc. listed under the PayPal logo is missing. How can I test this if I do not propery fill out that custom form?

 

Is it normal to have all of that information missing?

 

Thanks,

 

Brad

Share this post


Link to post
Share on other sites

Does anyone know where the setting is so that people can pay with their credit card instead of signing in to your paypal account

Share this post


Link to post
Share on other sites

Payment Data Transfer (optional):

 

Just wondering should the above be on or off in the paypal website?

 

Thanks!

Share this post


Link to post
Share on other sites
Hi there. I am also getting some 204 problems. See from my log:

I found the problem. It was the installation guide for 2.4 that put me on track. The problem was that my paypal email ID and business ID was NOT my primary mail address on PayPal.

 

I changed to the one that is primary, and today a IPN was verified without problems:

 

216.113.188.202 - - [03/Jul/2004:04:29:28 -0500] "POST /ipn.php HTTP/1.0" 200 0 "-" "-"

 

Rune

WaveBrazil

Share this post


Link to post
Share on other sites

Hi everyone... I am sorta new to all this, so please bare with me - what I mean is, I am an artist, not a computer wiz :o) and I think I am getting myself in trouble doing my website on my own *L*

 

Anyway, here is my problem...

I had installed PayPal IPN Gateway by Jeffrey Wilke a few months back and it was working fine.

Then yesterday I got a paypal payment and no "order" with it. I first thought it had something to do with the Attributes Sorter I had been tring to install earlier yesterday, but now that I have read some of these posts, I believe it has something to do with the CCGV that I installed last week.

 

I know that the version of the IPN contribution I had installed is not the same as the one this list is all about, but here is my question - if this contribution works better with CCGV, I'd rather install it and unistall the old one I have. To do that, what would I have to do?? Also, if there are any "quick fixes", can someone let me know?

 

Thanks a bunch!!

Share this post


Link to post
Share on other sites

Hello.

I had the purchase without account contrib installed, and just recently installed the Paypal IPN mod.

I've noticed a problem, and it must have to do with the Paypal contrib, because that's the only thing I've changed......

 

With the purchase without account contrib, there is a screen in which a person enters their address and such, and since I installed the PP contrib, when you put in an address in the purchase without account screen and then continue to select a payment method- after you click continue I get this error on the order confirmation screen in the deliver address section:

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /hsphere/local/home3/sapphire/sunshineshop.us/catalog/includes/functions/general.php on line 42

 

Warning: htmlspecialchars() expects parameter 1 to be string, array given in /hsphere/local/home3/sapphire/sunshineshop.us/catalog/includes/functions/general.php on line 42

 

Can anyone tell me how to fix this? Or is it just not possible to use these two contribs. together?

Share this post


Link to post
Share on other sites

Hello, greg, nice to talk to you again... :D ....i just have a new question, if i can see the paypal ipn in the admin orders section...that means everything is working fine right???? ;) ....Ha :lol: sounds a stupid question tho... :lol:

 

 

btw, where did you guys run into the 204 problem??? How to check out if you know you have that problem or not??? ;) :rolleyes:

Edited by markchiu

OS-commerce is great, but with other magical contributions, that is just so "COOL"!

Share this post


Link to post
Share on other sites

in 138 pages i see many referrences to trying to install the contribution on a clean osc -- ground zero. is there some reason why an ftp site cannot be set up to cater to these situations. then all a person would have to do to get up and running is copy everything pertinent over ther existing directory structure and configure.

 

if someone wants other contributions added AFTERWARDS, they can go to that support forum instead of making this one bear all the load. it is clear to me that the majority of the support provided by this forum is aiming at moving targets from these other contributions. it seems pointless for someone just getting started to have to wade through all of these other issues when getting started should be a ten minute proposition!

 

johann

Share this post


Link to post
Share on other sites
Hello.

I had the purchase without account contrib installed, and just recently installed the Paypal IPN mod.

I've noticed a problem, and it must have to do with the Paypal contrib, because that's the only thing I've changed......

 

 

Can anyone tell me how to fix this? Or is it just not possible to use these two contribs. together?

Not sure about your PWA problem but if you cannot get them working together I have the guest account contribution working with this one and have not had any problems with them playing nice together.


The Knowledge Base is a wonderful thing.

Do you have a problem? Have you checked out Common Problems?

There are many very useful osC Contributions

Are you having trouble with a installed contribution? Have you checked out the support thread found Here

BACKUP BACKUP BACKUP!!! You did backup, right??

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  

×