Paypal IPN Integration not working

Posts: 62
Joined: 08/31/2007
Bug Finder

Hello Everybody

I finally able to check out successfully after fully configuring my Paypal Business Account in Paypal Sandbox,

Now IPN call back is not working.
In the first attempt i left Paypal IPN URL blank in Paypal Profile.
Paypal IPN call back didn't work, no IPN logs.

In the second attempt i used http://www.mysite.com/?=uc_paypal/ipn
Now IPN call back worked partially.

In the logs i saw this.
"Receiving IPN at URL for order 0."
"IPN attempted with invalid order ID."

FYI my site doesn't use Clean-Urls.

Can anybody shed some light???

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Ahh, yes, it's coming back to me. I'm using a dynamic IPN URL, that's why you have to leave the field blank. The URL should be getting passed as part of the API call to process your PayPal payment. This should be safe for Clean URLs or not. It may be that the IPN just wasn't turned on before? Erase that field in your PayPal profile and try again if you don't mind.

Also, which PayPal service are you using for these tests?

Posts: 62
Joined: 08/31/2007
Bug Finder

I am using Paypal website payment standard.
Is ubercart require Paypal website payment Pro for the automation to work?

Posts: 62
Joined: 08/31/2007
Bug Finder

Hello Ryan

I tried once again just now too.
IPN info is not at all transfered if i left the url field blank in Paypal profile configuration.

I even tried configuring Paypal Access Credentials after obtaining one from Paypal,
But still no IPN info is transfered.
Even debug option didn't show anything in the logs

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Ok... can you look at the HTML source on the review order page for the submit form? Basically, the PayPal module is building a form w/ a hidden field named notify_url that should be getting populated with the right address. Can you see if it's putting anything in there at all?

Posts: 62
Joined: 08/31/2007
Bug Finder

Hi Ryan

notify_url hidden input field is perfectly created.

Form url also seems correct.

Posts: 14
Joined: 09/28/2007
Bug Finder

I had an IPN problem too, and in case it helps anyone else I'll share a couple of tips:

1) Make sure the IPN URL is blank--delete out the "http://" it's pre-filled with.
2) If you have HTTP authentication on your site (i.e. password protected) then IPN will not work! I had a password on my web root while developing the site, and IPN didn't work until I removed it.

Posts: 21
Joined: 12/14/2007

not working for me either..... notify_url is correct in the source code of the submit order page.

In paypal I have IPN enabled and without address. removed http://

I enabled the workflow-ng Update order status on full payment. it is configured .. order balance less or equal 0.0.

Using latest bzr version. 16 dic.
using sandbox account.

after paying and going back to the site, I see the Completed page. but I don't see any IPN entries in the log, and Order is in "Pending".

Sad

Posts: 167
Joined: 10/08/2007
Bug FinderGetting busy with the Ubercode.PayPal Hero

Double check the log for each order, not the drupal watchdog. In the admin, look at the "log" tab for an order stuck in pending. See if there is any record of the ipn coming in there. You might be seeing the paypal pending clobber bug. It could also just be an ipn configuration issue. Paypal IPN can take a long time to return sometimes. It definitely won't work if your site is basic-auth protected. Also, look for the post on setting up https if you use the secure pages module. You have to add the paypal cgi-bin path ... search for ubercart ssl.

--

Christopher Schaub
LuteGrass, LLC
http://www.lutegrass.com

Posts: 21
Joined: 12/14/2007

thanks
in the order log there is no ipn events... and I have logging ipn activated
just two entries:

12/16/2007 1
* Checkout message sent to xxx@xxx.com
12/16/2007 1
* Order status changed from in_checkout to pending.

maybe is a problem with the sandbox ? I could try tomorrow with live account...

Posts: 167
Joined: 10/08/2007
Bug FinderGetting busy with the Ubercode.PayPal Hero

Ok, then you have an ipn config issue. Check all of your variables in paypal again. Make sure the ipn url is blank and ipn is on. Also, make sure your paypal is set to live and to "complete sale" -- I don't think authorize only will fire the ipn until you capture payment?

--

Christopher Schaub
LuteGrass, LLC
http://www.lutegrass.com

Posts: 62
Joined: 08/31/2007
Bug Finder

Hi hedac

You actually have to disable IPN in your Paypal Profile, and leave the url field blank.

IPN should be enabled only when the site sends the data over Post method AFAIK,
Ubercart is a certified Cart Solution that uses some special APIs to talk with Paypal,

Posts: 21
Joined: 12/14/2007

it's strange... if I check the checkbox... and remove the http:// and save... it says IPN activated.. and On. But if I go back and edit again I see the checkbox unchecked... and the http:// again there...

doesn't work either IPN activated or not...

the return url in the paypal page after payment is
name="merchant_return" action="http://www.xxxxxxx.com/en/uc_paypal/wps/complete/20"

Posts: 21
Joined: 12/14/2007

ah I forgot to say that the cart is emptied correctly. it is just that the workflow is not being executed... but I don't know yet if it is because paypal doesn't send any ipn.. or that ipn is not being detected by ubercart....

also... can somebody explain me the settings in the workflow payment condition balance?

switch ($settings['balance_comparison']) {
case 'less':
return $balance < 0;
case 'less_equal':
return $balance <= .01;
case 'equal':
return $balance < .01 and $balance > -.01;
case 'greater':
return $balance >= .01;
}

Posts: 21
Joined: 12/14/2007

my last test. in live account.. not sandbox..
12/17/2007 - * PayPal payment for 0,01€ entered by -.
12/17/2007 - * Checkout message sent to xxxxxx
12/17/2007 - * Order status changed from in_checkout to payment_received.
12/17/2007 - * Order status changed from payment_received to pending.

the ipn is received... in sandbox it wasn't receiving any ipn in the logs...

order status changed from payment_received to pending again !?

and now it doesn't clean the shopping cart..

return url is ".../uc_paypal/wps/complete/21" and it goes to the cart. with the items still there.. not a complete purchase page as before...

:/

Posts: 21
Joined: 12/14/2007

schaub123... your patch at http://www.ubercart.org/forum/support/2104/ipn_woes_payment_status_gets_...
worked for me...
it goes to the completed order page and the status is payment received. not pending anymore

this is the log now

12/17/2007 - * PayPal payment for 0,01€ entered by -.
12/17/2007 - * Checkout message sent to xxxxxxx.
12/17/2007 - * Order status changed from in_checkout to payment_received.

finally it works!

Posts: 167
Joined: 10/08/2007
Bug FinderGetting busy with the Ubercode.PayPal Hero

Awesome!!! I was freaking out that I was the only one seeing this bug! I'm hoping a better patch works into the system though. It should probably just be an sql statement checking the status, much leaner than re-getting another temp order object.

--

Christopher Schaub
LuteGrass, LLC
http://www.lutegrass.com

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Guys, I'm seeing some intermittent HTTP errors and other IPN's not being verified issues now. I think it started when I began to have PayPal orders sent as line items, if that has anything to do with it. (Needed to do this in order for gift certificates Contrib to work with PayPal WPS).

Now this doesn't happen with EVERY order, only some. But enough to be a headache.

IPNs are, in fact, being received for each and every order - but some of them are not moving from Pending to Complete or Payment Received. Is this the same issue you've been seeing, and should I update to the latest bzr code? Have been meaning to do that, actually. Please advise.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 167
Joined: 10/08/2007
Bug FinderGetting busy with the Ubercode.PayPal Hero

Can you check the order log for a problem order. Do you see anything funny? Do you see the order status get switched from payment received back to pending. This only happens for code where the workflow stuff was added to change the order status (alpha8 and onward). The fix is the check the status in the database instead of the order object. Ryan posted an sql statement which does this. I'm not sure if it's been checked in yet, I don't think so. He might be coding a long-term fix which is a bit more elegant? Don't know.

If you are getting HTTP errors during validate, then it could be that a connection to paypal could not be established. This could be paypal's server being too busy to receive the connect or it might be something on your box opening an outbound connection.

// Post back to PayPal to validate
  $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
  $header .= "Host: ".$host[0].":80\r\n";
  $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
  $header .= "Content-Length: ". strlen($req) ."\r\n\r\n";

  $fp = fsockopen($host[0], 80, $errno, $errstr, 30);

  if (!$fp) {
    watchdog('uc_paypal', t('IPN failed with HTTP error.'), WATCHDOG_ERROR);
          return;
  }

I'd check the order log first for a problem order, this is a known issue of orders being stuck in pending. Here's the issue:

http://www.ubercart.org/forum/support/2104/ipn_woes_payment_status_gets_...

Hope this helps.

--

Christopher Schaub
LuteGrass, LLC
http://www.lutegrass.com

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Yeah I did see that - all great info! There is nothing in the order detail to show that it's ever getting moved out of Pending. I had seen this issue before installing WF-ng but hadn't seen it since. I was wondering if it was because the fsockopen call in uc_paypal_ipn was using port 80 when we are on an SSL - but switching that caused the IPN to never come through, either. So no solving there.

I'll update to the most recent bazaar today and see if that helps. Thanks for the reply!

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Also, I haven't seen anymore Pending orders come in yet, but I will keep an eye on things. Good possibility that this was just an isolated incident with PayPal's servers, or something that I've fixed already. Weird.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 13
Joined: 07/15/2008

I have a pending order status problem on my cart and have read this thread to find a solution. I also came across the Curl fix for users on godaddy behind their proxy at http://www.ubercart.org/forum/ideas_and_suggestions/5187/solution_uberca...

I thought this may have been the solution to my problem; but while I fixed the IPN verification problem, the pending orders continue. I upgraded from the beta version of ubercart to the latest recommended 1.0 release, hoping to incorporate all the changes suggested here as well. Were these changes included? If not do all these changes work with the 1.0 release?

Posts: 13
Joined: 07/15/2008

After more research on the site I finally found the answer to my problem; I did not activate the "Update order status on full payment" in workflow ng. Curios why this is not activated by default though.

This step was actually addressed here http://www.ubercart.org/comment/8360/Re_Pay_Pal_Standard_IPN_orders_stuc...

I missed this when skimming the forums for info related to my issue.

So my problems were solved in 2 steps..
1) using CURL in uc_paypal for the IPN verification. This was necessary on my godaddy hosted account because of the requirement to make the call through their proxy server. I had to use CURL as well to update my billing engine on an external server for the same reason.

2) Activating the "Update order status on full payment" task in workflow-ng.

Posts: 5
Joined: 10/31/2008

I am also stuck with orders in Pending using Paypal Sandbox. My configs:

- Ubercart and Ubercart Marketplace

- Payment settings:
-- Enable payment tracking
-- Log payments entered and deleted to order log
-- PayPal Website Payments Standard
--- Show debug info in the logs for Instant Payment Notifications
-- Payment gateway: PayPal Website Payments Pro enabled

- I enabled PP WPS payment and PP WPP gateway based on my understanding of UC Marketplace's requirements

There is no info in the logs regarding IPN. The only thing I see in the order log is:

11/01/2008 - * Checkout message sent to mytestemail@gmail.com.
11/01/2008 - * Order status changed from in_checkout to pending.

(Hope this is being reported in the correct place. Please advise.)