Jump to content

Recommended Posts

Help me out i cant get the items to show up on paypal. Ive been working on this for 1-3 weeks. I cant get this to work. I think its in the IPN.php or Payment.php i cant get that to work. It shows a # but not a item name. Can you please help me out thanks and i hope we can get this to work :).

 

Code IPN.php:

<?php
// this page only process a POST from paypal website
// so make sure that the one requesting this page comes
// from paypal. we can do this by checking the remote address
// the IP must begin with 66.135.197.
if (strpos($_SERVER['REMOTE_ADDR'], '66.135.197.') === false) {
exit;
}

require_once './paypal.inc.php';

// repost the variables we get to paypal site
// for validation purpose
$result = fsockPost($paypal['url'], $_POST); 

//check the ipn result received back from paypal
if (eregi("VERIFIED", $result)) { 

        require_once '../library/config.php';
            
        // check that the invoice has not been previously processed
        $sql = "SELECT od_status
                FROM tbl_order
                WHERE od_id = {$_POST['invoice']}";

        $result = dbQuery($sql);

        // if no invoice with such number is found, exit
        if (dbNumRows($result) == 0) {
            exit;
        } else {
        
            $row = dbFetchAssoc($result);
            
            // process this order only if the status is still 'New'
            if ($row['od_status'] !== 'New') {
                exit;
            } else {

                // check that the buyer sent the right amount of money
                $sql = "SELECT SUM(pd_price * od_qty) AS subtotal
                        FROM tbl_order_item oi, tbl_product p
                        WHERE oi.od_id = {$_POST['invoice']} AND oi.pd_id = p.pd_id
                        GROUP by oi.od_id";
                $result = dbQuery($sql);
                $row    = dbFetchAssoc($result);		
                
                $subTotal = $row['subtotal'];
                $total    = $subTotal + $shopConfig['shippingCost'];
                            
                if ($_POST['payment_gross'] != $total) {
                    exit;
                } else {
                   
				$invoice = $_POST['invoice'];
				$memo    = $_POST['memo'];
				if (!get_magic_quotes_gpc()) {
					$memo = addslashes($memo);
				}

                    // ok, so this order looks perfectly okay
                    // now we can update the order status to 'Paid'
                    // update the memo too
                    $sql = "UPDATE tbl_order
                            SET od_status = 'Paid', od_memo = '$memo', od_last_update = NOW()
                            WHERE od_id = $invoice";
                    $result = dbQuery($sql);
                }
            }
        }

} else { 
exit;
} 


?>

 

payment.php

<?php

/*
This page will submit the order information to paypal website.
After the customer completed the payment she will return to this site
*/

if (!isset($orderId)) 
exit;
require_once 'paypal.inc.php';

$paypal['invoice'] = $orderId;
$paypal['amount'] = $orderAmount;

?>
<center>
<p> </p>

<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FF0000"><strong>Processing 
Transaction . . . </strong></font></p>
</center>
<form action="<?= $paypal['url']; ?>" method="post" name="frmPaypal" id="frmPaypal">
<div align="center">
   <input type="hidden" name="amount" value="<?= $paypal['amount']; ?>">
<input type="hidden" name="invoice" value="<?= $paypal['invoice']; ?>">
<input type="hidden" name="item_name" value="<?= $paypal['item_name']; ?>">
<input type="hidden" name="business" value="<?= $paypal['business']; ?>">
<input type="hidden" name="cmd" value="<?= $paypal['cmd']; ?>">
<input type="hidden" name="return" value="<?= $paypal['site_url'] . $paypal['success_url']; ?>">
<input type="hidden" name="cancel_return" value="<?= $paypal['site_url'] . $paypal['cancel_url']; ?>">
<input type="hidden" name="notify_url" value="<?= $paypal['site_url'] . $paypal['notify_url']; ?>">
<input type="hidden" name="rm" value="<?= $paypal['return_method']; ?>">
<input type="hidden" name="currency_code" value="<?= $paypal['currency_code']; ?>">
<input type="hidden" name="lc" value="<?= $paypal['lc']; ?>">
<input type="hidden" name="bn" value="<?=$paypal['bn']; ?>">
<input type="hidden" name="no_shipping" value="<?= $paypal['display_shipping_address']; ?>">
</div>
</form>
<script language="JavaScript" type="text/javascript">
window.onload=function() {
window.document.frmPaypal.submit();
}
</script>

 

 

thanks and i hope you can get this to work for me i add the files to attachment.. Thanks. Cody.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/86309-paypal-paymentphp-ipnphp-help/
Share on other sites

what i mean is

 

I bought DTEC FC to test out the script and it gives me a feild here and type in the product. I want it were it tells you what you bought , inside of you typing in the item. So what i mean is i want paypal or the script above i gave you to apply the item what you bought in that item box there. i dont want customers to add a products in the feild. So i want the feild gone and i want paypal to apply the items that the client bought. I have all the paypal files above attached to the forum. Thank you :)

 

 

i added a picture to the attachments.

 

[attachment deleted by admin]

If you don't know how to check a variable, then this code is over your head.  I would suggest start off with the basics first.

 

what you mean ? Tell me more so iget what your talking about ... im kinda new to php so im kinda working my way up :)

That still dosent work . ... . ..  I dont know im about to quit on this script and say cuddle it . This flower is making me feel all warm and fuzzy .. ive been trying to get this to work 1-4 weeks and it wont work....

 

edit by neylitalo: aw :( I was hoping that our members wouldn't have that sort of potty mouth.

 

Seriously, though, knock it off.

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.