Posts: 9
Threads: 3
Joined: Aug 2011
Reputation:
0
I'm testing the donation form with Paypal Integration in MAMP (Mac Apache MySQL and PHP). It works great, but for some reason, the submissions aren't being finalizing even though it has finished the whole the process successfully (signup > process > paypal > success).
What am doing wrong? I was looking around the forum and seems like I need to tweak or do some testing with the IPN.php. But, what would I need to tweak?
Please let me know. I love form tools and has been incredible asset to my client work. Thank you once again!
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi just1ncase,
Thanks for the kind words! Glad it's coming in handy.
Yes, the ipn.php file is where the submission should get finalized. This line should get called for all successful payments that get put through:
PHP Code: ft_finalize_submission($pp["form_id"], $_POST['custom']);
If the submissions aren't being finalized, either the values being passed to that function aren't making it there, or
What I often do for debugging the ipn.php script is just to add in extra lines to send myself emails at the different spots. For starters, right before the line I quoted above, add the following line:
PHP Code: mail("your@email.com", "debugging", "Form ID: {$pp["form_id"]}, sub ID: {$_POST['custom']}");
If that part of the code is being called, it should send you an email containing the values being passed. That will tell you if the code IS in fact being called, and if the values are correct.
Failing that, try adding additional lines at the top of the file to confirm the ipn.php script is in fact being called.
Let me know how it goes!
- Ben
Posts: 9
Threads: 3
Joined: Aug 2011
Reputation:
0
I'm not getting an email whatsoever. This is the code I'm currently using:
PHP Code: <?php /* * ipn.php * * PHP Toolkit for PayPal v0.51 * http://www.paypal.com/pdn * * Copyright (c) 2004 PayPal Inc * * Released under Common Public License 1.0 * http://opensource.org/licenses/cpl.php */
mail("justin@justingaspar.com", "debugging", "Form ID: {$pp["form_id"]}, sub ID: {$_POST['custom']}");
$base_folder = dirname(__FILE__); require_once("$base_folder/includes/library.php"); require_once("$base_folder/includes/config.inc.php"); require_once("$base_folder/includes/global_config.inc.php");
// decide which post method to use switch ($pp["post_method"]) { // php compiled with libCurl support case "libCurl": $result = libCurlPost($pp["url"], $_POST); break;
// cURL via command line case "curl": $result = curlPost($pp["url"], $_POST); break;
// php fsockopen(); case "fso": $result = fsockPost($pp["url"], $_POST); break;
default: $result = fsockPost($pp["url"], $_POST); break; mail("justin@justingaspar.com", "debugging", "Form ID: {$pp["form_id"]}, sub ID: {$_POST['custom']}"); }
// successful payment! finalize the submission in the database if (eregi("VERIFIED", $result)) { mail("justin@justingaspar.com", "debugging", "Form ID: {$pp["form_id"]}, sub ID: {$_POST['custom']}"); ft_finalize_submission($pp["form_id"], $_POST['custom']); }
// oh-oh, something either went wrong, the payment didn't go through or someone's coming to this page // directly in their browser else {
}
?>
(Aug 21st, 2011, 3:49 PM)Ben Wrote: Hi just1ncase,
Thanks for the kind words! Glad it's coming in handy.
Yes, the ipn.php file is where the submission should get finalized. This line should get called for all successful payments that get put through:
PHP Code: ft_finalize_submission($pp["form_id"], $_POST['custom']);
If the submissions aren't being finalized, either the values being passed to that function aren't making it there, or
What I often do for debugging the ipn.php script is just to add in extra lines to send myself emails at the different spots. For starters, right before the line I quoted above, add the following line:
PHP Code: mail("your@email.com", "debugging", "Form ID: {$pp["form_id"]}, sub ID: {$_POST['custom']}");
If that part of the code is being called, it should send you an email containing the values being passed. That will tell you if the code IS in fact being called, and if the values are correct.
Failing that, try adding additional lines at the top of the file to confirm the ipn.php script is in fact being called.
Let me know how it goes!
- Ben
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
A-ha! In that case there are two possibilities:
1. you may not have configured things on PayPal's end. See this page:
http://docs.formtools.org/tutorials/payp...al_account
2. There's a syntax error on the ipn.php page which prevents any of the code being executed. To eliminate that as the cause, temporarily delete everything except the mail() line.
- Ben
Posts: 9
Threads: 3
Joined: Aug 2011
Reputation:
0
So, I went ahead and place the URL of the IPN in the Paypal business test account. However, since the original IPN file was in my testing server via MAMP, it wouldn't allow me to place that URL.
Thus, I uploaded the IPN in my Dropbox account and pasted the public URL as an alternative. But, it still doesn't work. Is it just best to upload the demo "donation" files online in order to successfully test the IPN?
I'm stumped and have no clue. My next step is probably just testing these files on a live hosting site online in Godaddy, but I'm afraid that I might experience the same thing.
Any thoughts or advice would be great! Thanks again for your help.
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Oh, I see - sorry I should have thought of that. No, you won't be able to use "localhost" to test IPN. PayPal won't know where to send the IPN message.
In order to test it on your local machine, you'll need to use your own IP address, as seen by the outside world. You'll also need to ensure that MAMP has been configured to permit people externally accessing your local site.
This opens up security issues though - even if you're doing it temporarily for testing. Any chance you could move the operation to a web server off your local box to test the IPN?
Again, sorry, I totally forgot you were working locally.
- Ben
Posts: 9
Threads: 3
Joined: Aug 2011
Reputation:
0
No worries, I'll go ahead and try it out on my web server. I'll let you know how it goes. Thanks!
|