Paypal, Payment Standard & IPN

  • amer
  • Born
  • Born
  • amer
  • Posts: 4

Post 3+ Months Ago

Hi all,

i don't seem to receive the verified status for the below code!

Checkout Page

Code: [ Select ]
<form action='/cgi-bin/webscr' target='_blank' method='post'>
<input type='hidden' name='cmd' value='_cart'>
<input type='hidden' name='upload' value='1'>
<input type='hidden' name='return' value='/confirm.php'>
<input type='hidden' name='business' value='email account'>
<input type='hidden' name='custom' value='1.141'>
<input type='hidden' name='receipt_id' value='12345'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='notify_url' value='confirm.php'>
  1. <form action='/cgi-bin/webscr' target='_blank' method='post'>
  2. <input type='hidden' name='cmd' value='_cart'>
  3. <input type='hidden' name='upload' value='1'>
  4. <input type='hidden' name='return' value='/confirm.php'>
  5. <input type='hidden' name='business' value='email account'>
  6. <input type='hidden' name='custom' value='1.141'>
  7. <input type='hidden' name='receipt_id' value='12345'>
  8. <input type='hidden' name='currency_code' value='USD'>
  9. <input type='hidden' name='notify_url' value='confirm.php'>



Confirm Page

Code: [ Select ]
<?php
session_start();
require_once('includes/config/config.inc.php');

$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";
$fp = fsockopen ('ssl paypal website', 443, $errno, $errstr, 30);

$custom = $_POST['custom'];
$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'];
$receiver_email = $_POST['receiver_email'];
$receipt_id = $_POST['receipt_id'];

if (!$fp){
   //Message
}else{
  fputs ($fp, $header . $req);
  while (!feof($fp)){
    $res = fgets ($fp, 1024);
    if (strcmp ($res, "VERIFIED") == 0){
      $Itemid = explode(",", $custom);
      $size_counter_array = sizeof($Itemid);
      foreach($Itemid as $item_new){
        $count_len = substr_count($item_new, '.');

          list($items_quantity, $item_product_id) = split('[.]', $item_new);
          )$QuerySuccess = (bool)@mysql_query("UPDATE store set quantity=(quantity - $items_quantity) WHERE id='".$item_product_id."'");
          if(QuerySuccess) echo "Success";
        }
      }
    }else if (strcmp ($res, "INVALID") == 0){
      //echo 2;
    }
  }
  fclose ($fp);
  setcookie($receipt_id,"", time()-60, "/");
}
?>
  1. <?php
  2. session_start();
  3. require_once('includes/config/config.inc.php');
  4. $req = 'cmd=_notify-validate';
  5. foreach ($_POST as $key => $value){
  6.   $value = urlencode(stripslashes($value));
  7.   $req .= "&$key=$value";
  8. }
  9. $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
  10. $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
  11. $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
  12. $fp = fsockopen ('ssl paypal website', 443, $errno, $errstr, 30);
  13. $custom = $_POST['custom'];
  14. $item_name = $_POST['item_name'];
  15. $item_number = $_POST['item_number'];
  16. $payment_status = $_POST['payment_status'];
  17. $payment_amount = $_POST['mc_gross'];
  18. $payment_currency = $_POST['mc_currency'];
  19. $txn_id = $_POST['txn_id'];
  20. $receiver_email = $_POST['receiver_email'];
  21. $receipt_id = $_POST['receipt_id'];
  22. if (!$fp){
  23.    //Message
  24. }else{
  25.   fputs ($fp, $header . $req);
  26.   while (!feof($fp)){
  27.     $res = fgets ($fp, 1024);
  28.     if (strcmp ($res, "VERIFIED") == 0){
  29.       $Itemid = explode(",", $custom);
  30.       $size_counter_array = sizeof($Itemid);
  31.       foreach($Itemid as $item_new){
  32.         $count_len = substr_count($item_new, '.');
  33.           list($items_quantity, $item_product_id) = split('[.]', $item_new);
  34.           )$QuerySuccess = (bool)@mysql_query("UPDATE store set quantity=(quantity - $items_quantity) WHERE id='".$item_product_id."'");
  35.           if(QuerySuccess) echo "Success";
  36.         }
  37.       }
  38.     }else if (strcmp ($res, "INVALID") == 0){
  39.       //echo 2;
  40.     }
  41.   }
  42.   fclose ($fp);
  43.   setcookie($receipt_id,"", time()-60, "/");
  44. }
  45. ?>


Thanks.

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 122 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.