Aug 21st, 2011, 8:08 PM
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