php - PayPal IPN not inserting into database -


i tested paypal donation button on localhost , inserts payment amount mysql database (verified on phpmyadmin) first time. after stops working

is there below prevent working?

config.php

<?php  require "paypal_integration_class/paypal.class.php"; require "config.php"; require "connect.php";  $p = new paypal_class; $p->paypal_url = $paypalurl;  if ($p->validate_ipn()) {     if($p->ipn_data['payment_status']=='completed')     {         $amount = $p->ipn_data['mc_gross'] - $p->ipn_data['mc_fee'];          mysql_query("   insert dc_donations (transaction_id,donor_email,amount,original_request)                         values (                             '".esc($p->ipn_data['txn_id'])."',                             '".esc($p->ipn_data['payer_email'])."',                             ".(float)$amount.",                             '".esc(http_build_query($_post))."'                         )");     } }  function esc($str) {     global $link;     return mysql_real_escape_string($str,$link); } ?> 

donation button

<!-- paypal donation button -->    <form action="<?php echo $paypalurl?>" method="post" class="paypalform"> <div>     <input type="hidden" name="cmd" value="_donations" />     <input type="hidden" name="item_name" value="donation" />      <!-- paypal email: -->     <input type="hidden" name="business" value="<?php echo $mypaypalemail?>" />      <!-- paypal send ipn notification url: -->     <input type="hidden" name="notify_url" value="<?php echo $url.'/ipn.php'?>" />       <!-- return page user navigated after donations complete: -->     <input type="hidden" name="return" value="<?php echo $url.'/thankyou.php'?>" />       <!-- signifies transaction data passed return page post -->     <input type="hidden" name="rm" value="2" />        <!--    general configuration variables paypal landing page. consult              http://www.paypal.com/integrationcenter/ic_std-variable-ref-donate.html more info  -->      <input type="hidden" name="no_note" value="1" />     <input type="hidden" name="cbt" value="go site" />     <input type="hidden" name="no_shipping" value="1" />     <input type="hidden" name="lc" value="us" />     <input type="hidden" name="currency_code" value="usd" />         <input type="double" name="amount">      <input type="hidden" name="bn" value="pp-donationsbf:btn_donate_lg.gif:nonhostedguest" />      <!-- can change image of button: -->     <input type="image" src="https://www.paypal.com/en_us/i/btn/btn_donate_lg.gif" name="submit" alt="paypal - safer, easier way pay online!" />    <img alt="" src="https://www.paypal.com/en_us/i/scr/pixel.gif" width="1" height="1" /> </div> </form> 

the first thing notice you're running db update if payment has status of completed. it's possible payments pending , in cases code skipped, of course.

how did test locally? did use ipn simulator or did run actual sandbox transaction system trigger real order? actual value of notify_url after php processed? you're using $url, value of that? if it's "localhost" won't work.

have checked paypal ipn history see if shows ipn's getting sent , might getting error result? have checked web server logs see if script getting hit?


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -