Paypal Sandbox payment problem -


i have following post button use paypal transactions:

    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">         <input type="hidden" name="cmd" value="_xclick">         <input type="hidden" name="business" value="my@email.com">         <input type="hidden" name="item_name" value="item description">         <input type="hidden" name="item_number" value="1">         <input type="hidden" name="amount" value="00.30">         <input type="hidden" name="no_shipping" value="1">         <input type="hidden" name="no_note" value="1">         <input type="hidden" name="currency_code" value="usd">         <input type="hidden" name="lc" value="us">         <input type="hidden" name="bn" value="pp-buynowbf">         <input type="hidden" name="return" value="website.com/index.php" />         <input type="hidden" name="cancel_return" value="website.com/index.php" />         <input type="hidden" name="rm" value="2">         <input type="hidden" name="notify_url" value="website.com/ipn/ipn.php">         <input type="hidden" name="custom" value="user_id">         <input type="submit" value="upgrade" />     </form> 

and following code in ipn.php

<?php include_once 'config.php'; // read post paypal system , add 'cmd' $req = 'cmd=_notify-validate';  foreach ($_post $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; }  // post paypal system validate $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://www.paypal.com', 443, $errno, $errstr, 30); $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); // assign posted variables local variables $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']; $payer_email = $_post['payer_email'];  if (!$fp) { // http error } else {     fputs ($fp, $header . $req);     while (!feof($fp)) {         $res = fgets ($fp, 1024);         if (strcmp ($res, "verified") == 0) {             // check payment_status completed             // check txn_id has not been processed             // check receiver_email primary paypal email             // check payment_amount/payment_currency correct             // process payment             mysql_query("update table set column='1' column2='13'");         }         else if (strcmp ($res, "invalid") == 0) {             // log manual investigation         }     } fclose ($fp); } ?> 

when click upgrade button , pay, doesnt show me go website button... there go my@email.com button, has 10 sec delay , takes me website... although popups warning encrypted data, dont know is.

also query use in ipn.php not execute.i dont know if goes ipn.php.

regarding go "my@email.com", happen if email specified doesn't map account in paypal sandbox. perhaps you're using real email in button instead of sandbox account email?

another possibility test account @ "my@email.com" not business account. if have business account should reflect business name instead.

as not receiving ipns, sandbox doesn't great job @ delivering ipns on time, if @ all. i'd suggest try integrating using express checkout instead of website payments standard. express checkout little bit of confusing dance easy implement after try understand it. here's think best doc explaining how express checkout works:

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_id=developer/e_howto_api_ecsimpleintegration

and when you're ready dive implementation should here:

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_id=developer/howto_api_reference

the nice thing using express checkout instead of relying on ipn figure out payment status moment user returns site, , don't have sit around waiting ipn show up.

with express checkout override business name custom "brand name" can use same receiving paypal account on different sites different "brands".

good luck!


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -