Alertpay IPN problems

Discussion in 'PHP' started by mmikeyy, May 20, 2008.

  1. #1
    I've set up alertpay, using there guide, and there example script with a few mods...

    The page with the payment button.
    
    <form method="post" action="https://www.alertpay.com/PayProcess.aspx" >
    <input type="hidden" name="ap_purchasetype" value="item"/>
    <input type="hidden" name="ap_merchant" value="alertpay@xxx.com"/>
    <input type="hidden" name="ap_itemname" value="Testing"/>
    <input type="hidden" name="ap_description" value="Testing"/>
    <input type="hidden" name="ap_currency" value="USD"/>
    <input type="hidden" name="ap_returnurl" value="http://www.xxx.com/thankyou.php"/>
    <input type="hidden" name="ap_itemcode" value="<? echo $_SESSION["username"]; ?>"/>
    <input type="hidden" name="ap_quantity" value="1"/>
    <input type="hidden" name="ap_amount" value="10"/>
    <input type="image" name="ap_image" src="https://www.alertpay.com/Images/BuyNow/big_pay_01.gif"/>
    </form>
    
    PHP:
    The ipn.php file, which is where the data should be getting sent too
    
    <?
    require("ipndata.php"); // imports security code
    $ap_sec_code = $_POST['ap_securitycode'];
    if (strcmp($security_code, $ap_sec_code) == 0){
      if($_POST["ap_itemname"] == "Testing") {
        $username=$_POST["ap_itemcode"];
        $query=mysql_query("INSERT INTO upgraded VALUES (NULL, '{$_SESSION["username"]}', curdate())");
      }
    }
    ?>
    
    PHP:
    And then just the thankyou.php has a thanks message.

    But when i run a test payment (in test mode) the upgraded table still remain blank... any help or ideas?
     
    mmikeyy, May 20, 2008 IP
  2. kijkij

    kijkij Peon

    Messages:
    346
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    First check this by using mail() instead of mysql_query() function if it works then double check your query.
     
    kijkij, Jun 30, 2008 IP