CubeCart Forums: Getting PayPal IPN / AutoReturn to WORK! - CubeCart Forums

Jump to content

  • (16 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Getting PayPal IPN / AutoReturn to WORK! Here's what you need to change...

#1 User is offline   Sir William 

  • Programmer / Developer
  • Group: Staff
  • Posts: 1,715
  • Joined: 23-December 04

Posted 25 September 2005 - 03:35 AM

Ok, as many of you know, the PayPal IPN / PDT (AutoReturn) did not work quite right in early 3.0.x releases, but it has been long since fixed. This post used to contain some extra code that early users needed to add to their stores. But since this thread started in SEPTEMBER and nobody seems to notice that part, I figured I'd better edit it to let them know.

The PayPal Standard / IPN files work properly 'out of the box' IF you have your store and PayPal account configured correctly. 99% of the problems I've seen with this have been configuration problems, NOT code problems.

That said, there is an excellent tutorial available HERE. Simply go there, get the tutorial, follow it and enjoy this excellent payment gateway.

:(

Edited: 3/6/2006 by Sir William

This post has been edited by ansuk: 24 September 2006 - 10:06 AM

0

#2 User is offline   tbladecki 

  • Group: Members
  • Posts: 477
  • Joined: 31-July 05

Posted 25 September 2005 - 03:45 AM

I am assuming that this will fix the 3.0.2 version?? But I knwo what people say about assumptions. LOL
0

#3 User is offline   Sir William 

  • Programmer / Developer
  • Group: Staff
  • Posts: 1,715
  • Joined: 23-December 04

Posted 25 September 2005 - 03:54 AM

If memory serves, these files weren't changed from 3.0.2 to 3.0.3. I just double checked in WinMerge and they did change, but not in any way that will affect the changes I outlined above. There are differences in the way shipping & taxes are dealt with.
0

#4 User is offline   baxterg 

  • Group: Members
  • Posts: 35
  • Joined: 17-September 05

Posted 25 September 2005 - 10:32 AM

Tried your fix, but still get the "Sorry your order failed" message......
0

#5 User is offline   sunshine 

  • Group: Members
  • Posts: 610
  • Joined: 05-September 05

Posted 25 September 2005 - 10:41 AM

Hi Sir William,

Your first bit of code says 'Worldpay'. I should be changing that to paypal shouldn't I? :(
0

#6 User is offline   roban 

  • Group: Members
  • Posts: 3,666
  • Joined: 19-December 04

Posted 25 September 2005 - 02:11 PM

To get it to return you have to go to your pay pal account, sign up for a business account (easy) and enable Payment Data Transfer and enable Instant Payment Notification (IPN).
0

#7 User is offline   Sir William 

  • Programmer / Developer
  • Group: Staff
  • Posts: 1,715
  • Joined: 23-December 04

Posted 25 September 2005 - 02:31 PM

My bad!!! I missed one more SIMPLE change. I edited the original post to include it, but I'll show it again here.

After the change you made in transfer.inc.php, there's a line that says:

if($result['status']== "2"){

You need to add a "[0]" so that it will now read:

if($result[0]['status']== "2"){

Do that and you should be fine. I apologize for the mistake. It was early this morning when I made the other post and I just missed it.

Oh, and you don't have to change the "WorldPay". That was just to show you where in the file you're inserting the lines.
0

#8 User is offline   MASsIVE 

  • Group: Members
  • Posts: 55
  • Joined: 31-August 05

Posted 25 September 2005 - 02:44 PM

Thanks for this Sir Williams, I shall try it as soon as I get some snooze :wacko:

I sent you an email about 3-4 days ago did ya happen to recieve it ?


Also which file and line(s) do I need to edit to NOT allow downloads immediatly after purchase completed, or is this setting in admin? I cannot find this sad.gif
This would surely help prevent alot of headaches for potential fraud
My completed orders are coming up as processed and the download appears immediately which I think Id rather put on processing, where can I enable/change this?

Thanks again
0

#9 User is offline   Sir William 

  • Programmer / Developer
  • Group: Staff
  • Posts: 1,715
  • Joined: 23-December 04

Posted 25 September 2005 - 03:02 PM

Massive, that's controlled in the ipn.php file. I haven't tried to do that, so I can't be more specific.
0

#10 User is offline   baxterg 

  • Group: Members
  • Posts: 35
  • Joined: 17-September 05

Posted 25 September 2005 - 03:06 PM

Quote

$result = $db->select("SELECT status  FROM ".$glob['dbprefix']."CubeCart_order_sum WHERE sec_order_id = ".$db->mySQLSafe($_GET['tx']) );
 
  if($result[0]['status']==2){
  return TRUE;
  } else {
  return FALSE;
  }
 
}


This is what is in my transfer.inc.php file....

Quote

################################################################################
############
// Following lines added for Sir William's PayPal AutoReturn Fix
} elseif(isset($_GET['tx']) && isset($_GET['st'])) {
$basket['gateway'] = "PayPal";
################################################################################
############


This is the confirmed.inc.php file....

Obviously there's the rest of the files, but those are the bits added & changed.

Paypal IPN is on - it transfers to Paypal okay, with the correct info, ie cart id etc, payment is made as per normal, but the return which is pointing at http://{mydomain}/confirmed.php is producing a "login to see this page" then "sorry order failed" message.

No PDT switched on - tho did try it both ways to no avail....

HELP before I throw my PC straight out the window and follow it.... :wacko:
0

#11 User is offline   Sir William 

  • Programmer / Developer
  • Group: Staff
  • Posts: 1,715
  • Joined: 23-December 04

Posted 25 September 2005 - 03:15 PM

Make sure that that $return= line is all on ONE line. That can have an ill effect. But I had no way to force the forum not to break the line.

Also, PDT MUST be on.

Your particular problem arises in the fact that it wants you to log in. Something is not right there. The site won't pass the $_GET variables through the login process. Figure that part out first.
0

#12 User is offline   baxterg 

  • Group: Members
  • Posts: 35
  • Joined: 17-September 05

Posted 25 September 2005 - 04:58 PM

Nope, been through it all and it's got me stumped....nothing else was changed from original files cept the additions you mention..the only other thing was to enable PDT in Paypal...after that it seems to return ok, but to a Need To Login ...

Failed order after that still...

Had a look through and can't see anywhere where the variables wouldnt get through as before

??
0

#13 User is offline   Sir William 

  • Programmer / Developer
  • Group: Staff
  • Posts: 1,715
  • Joined: 23-December 04

Posted 25 September 2005 - 06:23 PM

As I said, you should NOT have to login after the return from PayPal. You need to concentrate on THAT problem. You solve that and I bet the other will go away.

I'd look at cookie / session issues. Try clearing your cache and all cookies and trying it again just in case it's your machine. If it still doesn't work, setup a product at a penny and have somebody else buy it to test the process out.
0

#14 User is offline   kinetic 

  • WebDude
  • Group: Members
  • Posts: 584
  • Joined: 09-June 03

Posted 26 September 2005 - 12:25 AM

Ive finally got my CLients Paypal IPN auto return working!!!
Dayuuuum we need to clone Sir Willliam... */*

only hitch I had was I needed to apply the patch to the transfer.inc.php for payapal (removing the tax line hidden field)
If the total amount in PayPal is wrong.

Quote

Open: /modules/gateway/PayPal/transfer.inc.php

Please remove line 105:

<input type='hidden' name='tax' value='".$amount."' />



Upload this to your server and it is fixed.


after that Sir Williams IPN patch worked beautifully!!!

Thanks Mucho much Bill you rock!!!
Yall should PaypAL Bill some paypal love for writing this patch
then maybe he will take the time to write a proper hack/patch with add afters and replace withs...
0

#15 User is offline   Sir William 

  • Programmer / Developer
  • Group: Staff
  • Posts: 1,715
  • Joined: 23-December 04

Posted 26 September 2005 - 12:46 AM

I'll do one better than that Steve, I'll post both files.

If you have NOT hacked either of these files in any way, then you can simply upload these to your site and be just fine.

http://www.swscripts...Pal-IPN-Fix.zip

You will upload confirmed.inc.php to /includes/content/.

transfer.inc.php goes into /modules/gateway/PayPal/.
0

Share this topic:


  • (16 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users