Jump to content

Please can you help?


nightlife

Recommended Posts

Hi, please can anyone help, i have a new php site, and run a games server, we have just set up paypal on our site, and members have donated, the payment does come to our mail addy, and onto pay pal, but does not show on the site they made any payments, i am running this one Module's Name:NukeTreasury ,Module's Version: 1.0 please could you tell me what i might be doing wrong, and how to fix this, yes i am a noob at php, so please make this easy. thanks
Link to comment
Share on other sites

I am not familiar with NukeTreasury, but this might be a misconfiguration on the paypal end. Do you have Auto-Return turned on? It's under My Account > Preferences > Website Payment Preferences. You'll also want Payment Data Transfer turned on, and have a valid URL in the Return URL blank.
Link to comment
Share on other sites

Put the "letters and numbers" into your code and they become code =)

PayPal encodes the form data as to hide your sensive account information so it's okay to place it into your code.  When you view it in a browser you "should" see what you want to see.

Good luck!
Link to comment
Share on other sites

What i mean by "they" is this! my pay pal account said to place the code into the site,it said this after clicking the two parts you told me. "Auto-Return turned on? It's under My Account > Preferences > Website Payment Preferences. You'll also want Payment Data Transfer turned on, and have a valid URL in the Return URL blank." then it asked for me to add the code to my site." but like i have already said i have no idea what part to add the code i'e string of numbers and letters?  does this make any sence to you? or am i mis understanding what i should be doing.  if i new what file this code should be placed onto and in what place to add the code i'm sure i could find it, please point me in the right direction thanks. "Auto-Return turned on? It's under My Account > Preferences > Website Payment Preferences. You'll also want Payment Data Transfer turned on, and have a valid URL in the Return URL blank." then it asked for me to add the code to my site.
Link to comment
Share on other sites

does the code go on her or not? if not what part or file please?



ipnppd.php
File Type: PHP script text
[code]sql_query($query_cfg))) {
message_die(GENERAL_ERROR, 'Could not obtain nuke tresury config data', '', __LINE__, __FILE__, $sql);
}

while ($cfgset && $row = $db->sql_fetchrow($cfgset)) {
$tr_config[$row['name']] = $row['value'];
}

$ERR = 0;
$log = "";
$loglvl = $tr_config[ipn_dbg_lvl];
define(_ERR, 1);
define(_INF, 2);

if (isset($_GET['dbg'])) {
$dbg = 1;
} else {
$dbg = 0;
}

if ($dbg) {
dprt("Debug mode activated", _INF);
echo "PHP-Nuke Treasury modPayPal Instant Payment Notification scriptSee below for status:";
echo "----------------------------------------------------------------";
$receiver_email = $tr_config['receiver_email'];
}

$req = "cmd=_notify-validate";

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}

$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$txn_type = $_POST['txn_type'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];

dprt("Opening connection and validating request with PayPal...", _INF);

$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);

if (!$fp) {
dprt("FAILED to connect to PayPAl", _ERR);
die();
}

dprt("OK!", _INF);

fputs ($fp, $header . $req);

if (!$dbg && strcasecmp($_POST['business'], $tr_config['receiver_email']) != 0) {
dprt("Incorrect receiver email: $receiver_email , aborting", _ERR) ;
$ERR = 1;
}

$insertSQL = "";

if ($txn_id) {
$sql = "SELECT * FROM " . $prefix . "_treasury_transactions WHERE txn_id = '$txn_id'";

if (!($Recordset1 = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain data from nuke tresury transactions', '', __LINE__, __FILE__, $sql);
}

$row_Recordset1 = $db->sql_fetchrow($Recordset1);
$NumDups = $db->sql_numrows($Recordset1);
}

while (!$dbg && !$ERR && !feof($fp)) {
$res = fgets ($fp, 1024);

if (strcmp ($res, "VERIFIED") == 0) {
dprt("PayPal Verified", _INF);

if (strcmp($payment_status, "Refunded") == 0) {
dprt("Transaction is a Refund", _INF);

if (($NumDups == 0) || strcmp($row_Recordset1[payment_status], "Completed") || (strcmp($row_Recordset1[txn_type], "web_accept") != 0 && strcmp($row_Recordset1[txn_type], "send_money") != 0)) {
dprt("IPN Error: Received refund but missing prior completed transaction", _ERR);

foreach($_POST as $key => $val) {
dprt("$key => $val", $_ERR);
}
break;
}
if ($NumDups != 1)
{
dprt("IPN Error: Received refund but multiple prior txn_id's encountered, aborting", _ERR);

foreach($_POST as $key => $val) {
dprt("$key => $val", $_ERR);
}
break;
}

$mc_gross = -$_POST['mc_gross'];
$mc_fee = -$_POST['mc_fee'];
$insertSQL = sprintf("INSERT INTO " . $prefix . "_treasury_transactions (`txn_id`,`business`,`item_name`, `item_number`, `quantity`, `invoice`, `custom`, `memo`, `tax`, `option_name1`, `option_selection1`, `option_name2`, `option_selection2`, `payment_status`, `payment_date`, `txn_type`, `mc_gross`, `mc_fee`, `mc_currency`, `settle_amount`, `exchange_rate`, `first_name`, `last_name`, `address_street`, `address_city`, `address_state`, `address_zip`, `address_country`, `address_status`, `payer_email`, `payer_status`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $_POST['txn_id'],$_POST['business'],$_POST['item_name'],$_POST['item_number'],$_POST['quantity'],$_POST['invoice'],$_POST['custom'],$_POST['memo'],$_POST['tax'],$_POST['option_name1'],$_POST['option_selection1'],$_POST['option_name2'],$_POST['option_selection2'],$_POST['payment_status'],strftime('%Y-%m-%d %H:%M:%S',strtotime($_POST['payment_date'])),$_POST['txn_type'],$mc_gross,$mc_fee,$_POST['mc_currency'],$_POST['settle_amount'],$_POST['exchange_rate'],$_POST['first_name'],$_POST['last_name'],$_POST['address_street'],$_POST['address_city'],$_POST['address_state'],$_POST['address_zip'],$_POST['address_country'],$_POST['address_status'],$_POST['payer_email'],$_POST['payer_status']);

dprt($insertSQL, _INF);

if (!($Result1 = $db->sql_query($insertSQL))) {
message_die(GENERAL_ERROR, 'Could not insert data into nuke tresury transactions', '', __LINE__, __FILE__, $sql);
}

dprt("SQL result = " . $Result1, _INF);
break;
} else if ((strcmp($payment_status, "Completed") == 0) && ((strcmp($txn_type, "web_accept")== 0) || (strcmp($txn_type, "send_money")== 0))) {
dprt("Normal transaction", _INF);

if ($lp) {
fputs($lp, $payer_email . " " . $payment_status . " " . $_POST['payment_date'] . "\n");
}

if ($NumDups != 0) {
dprt("Valid IPN, but DUPLICATE txn_id! aborting", _ERR);

foreach($_POST as $key => $val) {
dprt("$key => $val", $_ERR);
}
break;
}

            //@RJR-Pwmg@Rncvkpwo@-@Eqratkijv@(e)@VgejIHZ.eqo
$insertSQL = sprintf("INSERT INTO " . $prefix . "_treasury_transactions (`txn_id`,`business`,`item_name`, `item_number`, `quantity`, `invoice`, `custom`, `memo`, `tax`, `option_name1`, `option_selection1`, `option_name2`, `option_selection2`, `payment_status`, `payment_date`, `txn_type`, `mc_gross`, `mc_fee`, `mc_currency`, `settle_amount`, `exchange_rate`, `first_name`, `last_name`, `address_street`, `address_city`, `address_state`, `address_zip`, `address_country`, `address_status`, `payer_email`, `payer_status`) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $_POST['txn_id'],$_POST['business'],$_POST['item_name'],$_POST['item_number'],$_POST['quantity'],$_POST['invoice'],$_POST['custom'],$_POST['memo'],$_POST['tax'],$_POST['option_name1'],$_POST['option_selection1'],$_POST['option_name2'],$_POST['option_selection2'],$_POST['payment_status'],strftime('%Y-%m-%d %H:%M:%S',strtotime($_POST['payment_date'])),$_POST['txn_type'],$_POST['mc_gross'],$_POST['mc_fee'],$_POST['mc_currency'],$_POST['settle_amount'],$_POST['exchange_rate'],$_POST['first_name'],$_POST['last_name'],$_POST['address_street'],$_POST['address_city'],$_POST['address_state'],$_POST['address_zip'],$_POST['address_country'],$_POST['address_status'],$_POST['payer_email'],$_POST['payer_status']);
dprt($insertSQL, _INF);

if (!($Result1 = $db->sql_query($insertSQL))) {
message_die(GENERAL_ERROR, 'Could not insert data into nuke tresury transactions', '', __LINE__, __FILE__, $sql);
}

dprt("SQL result = " . $Result1, _INF);
break;
} else {
dprt("Valid IPN, but not interested in this transaction", _ERR);

foreach($_POST as $key => $val) {
dprt("$key => $val", $_ERR);
}
break;
}
} else if (strcmp ($res, "INVALID") == 0) {
dprt("Invalid IPN transaction, this is an abnormal condition", _ERR);

foreach($_POST as $key => $val) {
dprt("$key => $val", $_ERR);
}
break;
}
}

if ($dbg) {
$sql = "SELECT * FROM " . $prefix . "_treasury_transactions LIMIT 10";

echo "Executing test query...";

if (!($Result1 = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain data from nuke tresury transtransactions', '', __LINE__, __FILE__, $sql);
}

if ($Result1) {
echo "PASSED!";
} else {
echo "FAILED";
}

echo "PayPal Receiver Email: $tr_config[receiver_email]" ;
}

if ($log) {
dprt("Logging events\n", _INF);

$sql = "INSERT INTO " . $prefix . "_treasury_translog VALUES ('','" . strftime('%Y-%m-%d %H:%M:%S',mktime()) . "', '" . strftime('%Y-%m-%d %H:%M:%S',strtotime($_POST['payment_date'])) . "','" . addslashes($log) . "')";

if (!($Result1 = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not insert data into nuke tresury translog', '', __LINE__, __FILE__, $sql);
}

$sql = "SELECT id as lowid FROM " . $prefix . "_treasury_translog ORDER BY id DESC LIMIT " . $tr_config[ipn_log_entries];

if (!($Result1 = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not obtain nuke tresury translog', '', __LINE__, __FILE__, $sql);
}

while($recordSet = $db->sql_fetchrow($Result1)) {
$lowid = $recordSet[lowid];
}

$sql = "DELETE FROM " . $prefix . "_treasury_translog WHERE id < '" . $lowid . "'";

if (!($Result1 = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not delete nuke tresury translog', '', __LINE__, __FILE__, $sql);
}
}

fclose ($fp);

if ($lp) {
fputs($lp,"Exiting\n");
}

if ($lp) {
fclose ($lp);
}

if ($dbg) {
echo "----------------------------------------------------------------";
echo "If you don't see any error messages, you should be good to go!";
}

function dprt($str, $clvl) {
global $dbg, $lp, $log, $loglvl;

if ($lp) {
fputs($lp, $str . "\n");
}

if ($dbg) {
echo $str . "";
}

if ($clvl <= $loglvl) {
$log .= $str . "\n";
}
}

die();

?>[/code]
Link to comment
Share on other sites

You're more than likely looking for the identity token -- which is generated by Paypal to confirm that your website is who it says it is. This page is accessible at: My Account > Profile > Website Payment Preferences. You should be able to turn on payment data transfer and then have an identity token generated.

Here's paypal's manuel on the subject:
https://www.paypal.com/en_US/pdf/PP_OrderManagement_IntegrationGuide.pdf#search=%22pp_ordermanagement_integrationguide.pdf%22
Link to comment
Share on other sites

I dont have any nuketreasury documentation.  I'm sure its s setting on my site has to be changed, or scriped edited to show the site what to look  for in paypal account, i have the code paypal gave me, would like some one how set up paypal and has it working right on there site to please help me thanks?
Link to comment
Share on other sites

I see some code in what you've posted expecting instant payment notification. That is yet another feature offered by paypal (which is under your profile's selling preferences by the name "instant payment notification preferences"). Try getting that setup and see if it works.

If you haven't already done so, you might also want to setup a sandbox account on paypal here: https://developer.paypal.com -- this can help you to test your impelmentation while not dealing with real money.

Also, most of your problems appear to be paypal related and not so much php related. If you're looking for paypal experts, here's their board: http://www.paypaldev.org
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.