Posts: 31
Threads: 9
Joined: Sep 2009
Reputation:
0
Hey there FormTools Community,
I've been having problems with a Form for registering an Attendee for a convention.
The attendee fills out the form and selects their badge, which then sends it to PayPal.
Using the API for holding the submission, it won't finalize the submission.
Code: // successful payment! finalize the submission in the database
if (eregi("VERIFIED", $result))
{
ft_finalize_submission($pp["form_id"], $_POST['custom']);
}
That line should be called, but it won't. And I'm not sure why. I have tried finalizing the submission before it's sent to PayPal, but when it sends it back, it won't talk to FormTools.
Thanks,
Axel
Posts: 33
Threads: 12
Joined: Sep 2009
Reputation:
0
I think that's the same exact problem I'm having. I've been trying for the past 2 days to get this to work but I haven't figured out what exactly was going on.
I'm using the tutorial Donate form verbatim with the instructions and it's getting to my paypal account. When I pay and everything and return to the site, the success.php file is called with all the relevant information being printed...but it never gets saved to to form! Argh, pulling my hair out over here!
Your line of code may help though. I'll let you know if I figure anything out on this end...
Posts: 33
Threads: 12
Joined: Sep 2009
Reputation:
0
Sep 23rd, 2009, 7:19 PM
(This post was last modified: Sep 23rd, 2009, 7:47 PM by Jaace.)
I'm trying to debug ipn.php...and there may be other problems in some of the other files not directly accessed by a URL...but here's what I found so far in ipn.php:
1. This chunk of code seems to break at the second require_once:
PHP Code: $folder = dirname(__FILE__); require_once("$folder/includes/library.php"); require_once("$folder/includes/config.inc.php"); require_once("$folder/includes/global_config.inc.php");
The php error I'm getting for this is:
PHP Code: Warning: require_once(/path/to/my/donate/formtools/global/includes/config.inc.php) [function.require-once]: failed to open stream: No such file or directory in /path/to/my/donate/donate/ipn.php on line 16
Fatal error: require_once() [function.require]: Failed opening required '/path/to/my/donate/formtools/global/includes/config.inc.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /path/to/my/donate/donate/ipn.php on line 16
Now, you'll notice that this is the complete wrong directory...why does it try to grab it out of formtools/global/includes and not donate/includes??? I since changed these require_once lines to a full path to not use the $folder variable. **NOTE the folder variable seems to be special, because when I changed it to $someFolder it worked as it should...no errors. Well, none at least until this next one which I'm still trying to figure out.
2. Nevermind the line numbers here. I've added some rudimentary debugging code, so these line numbers are probably different than yours. Nonetheless you can see where the problem lies:
PHP Code: Notice: Undefined index: post_method in /path/to/my/donate/donate/ipn.php on line 33
Notice: Undefined index: url in /path/to/my/donate/donate/ipn.php on line 51
Notice: Undefined variable: postdata in /path/to/my/donate/donate/includes/global_config.inc.php on line 133
Notice: Undefined index: scheme in /path/to/my/donate/donate/includes/global_config.inc.php on line 136 0: php_network_getaddresses: getaddrinfo failed: Name or service not known Notice: Undefined variable: info in /path/to/my/donate/donate/includes/global_config.inc.php on line 175
Notice: Undefined index: custom in /path/to/my/donate/donate/ipn.php on line 66
It doesn't seem to like $paypal["post_method"], that's line 33
Line 51 is PHP Code: $result = fsockPost($paypal["url"], $_POST);
Line 133 in the global_config.inc.php file that comes with the donate files hits the error with PHP Code: $postdata .= "cmd=_notify-validate";
Line 136 in that same file is PHP Code: if ($web["scheme"] == "https")
Line 175 in that same file again is
So I'm really at a loss of how to correct all these. At first I thought it was just my paths were off...but it seems to go much deeper than that.
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
(Sep 23rd, 2009, 1:49 PM)axel Wrote: Hey there FormTools Community,
I've been having problems with a Form for registering an Attendee for a convention.
The attendee fills out the form and selects their badge, which then sends it to PayPal.
Using the API for holding the submission, it won't finalize the submission.
Code: // successful payment! finalize the submission in the database
if (eregi("VERIFIED", $result))
{
ft_finalize_submission($pp["form_id"], $_POST['custom']);
}
That line should be called, but it won't. And I'm not sure why. I have tried finalizing the submission before it's sent to PayPal, but when it sends it back, it won't talk to FormTools.
Thanks,
Axel
Hi Axel,
For debugging, try adding a mail() line in that if-statement that sends you an email containing the two parameters: $pp["form_id"] and $_POST["custom"].
Just check that both are being returned from PayPal correctly. If they ARE, then either these values being passed to and from PayPal are incorrect or that function isn't doing it's job.
- Ben
Posts: 33
Threads: 12
Joined: Sep 2009
Reputation:
0
Sep 24th, 2009, 6:47 AM
(This post was last modified: Sep 24th, 2009, 6:59 AM by Jaace.)
Hi Axel and Ben,
My last post I noted a bunch of errors...but probably only the first one was true since I was directly calling ipn.php and not running through the entire process. Obviously this would cause those variables in my second set of errors to be unset (duh!)...but I was working all day so my head hurt and I didn't catch this.
Anyway, after looking at your response, Ben, I've tried what you said with the mail() function, I put this function in both the if and the else block, and it is in fact printing the $pp["form_id"] and $_POST['custom'] variables correctly. However, it isn't sending me doing this in the if block...only the else block. This lead me to believe that, at least in my install, the eregi("VERIFIED", $result) line is false.
I then printed the $result variable out in my mail function as well and that comes back blank. I'm trying to figure out what to do next.
Posts: 33
Threads: 12
Joined: Sep 2009
Reputation:
0
Sep 24th, 2009, 11:48 AM
(This post was last modified: Sep 26th, 2009, 11:00 AM by Jaace.)
Well, I believe I have solved it! I'm assuming we have the same issue...
The paths is not the issue...except for some reason using the variable name $folder. (is that a reserved word)? Anyway, it doesn't work for mine, and I had to change it to $base_folder so that it wouldn't get messed up and not call the other two require_once lines below library in ipn.php.
The other problem is actually really easy to fix, but a pain in the ass to find! :-) It's a typo of sorts... In ipn.php the switch statement is making use of $paypal["post_method"] and $paypal["url"] in each of the conditions. These variables old carry overs from Form Tools 1 (or maybe they were supposed to somehow be included in the $paypal array that is the result of the array_merge at the top of paypal_submit.php. Either way it doesn't get carried over to ipn.php)...but since Form Tools 2, these variables have moved from config.inc.php to the includes/library.php folder. They also got renamed:
$pp["url"] and $pp["post_method"].
Posts: 31
Threads: 9
Joined: Sep 2009
Reputation:
0
Thank you so much. This update fixes everything and makes me so happy!
I really wanted to use FormTools 2 with PayPal for so long, I just never could get the IPN to work with it.
Thank you once again.
=]
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Brilliant, thanks Jaace!!
I'll fix up the downloadable zipfile today.
Thanks again!
- Ben
|