2011-06-29 73 views
1

paypal ipn案件不叫在貝寶「現在支付」。 在貝寶按鈕中設置以下內容。paypal ipn案件不在貝寶呼叫「現在支付」

return : "http://localhost/paypal.php?ch=return" 

cancel_return : "cancel_return" value="http://localhost/paypal.php?ch=cancel" 

notify_url : value="http://localhost/paypal.php?ch=ipn" 

paypal_form.php

<form name="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> 
<input type="hidden" name="cmd" value="_xclick"> 
<input type="hidden" name="rm" value="2"> 
<input type="hidden" name="no_notes" value="1"> 
<input type="hidden" name="custom" value="1"> 
<input type="hidden" name="business" value="[email protected]"> 

<input type="hidden" name="return" id="return" value="http://localhost/paypal.php?ch=return"> 
<input type="hidden" name="cancel_return" id="cancel_return" value="http://localhost/paypal.php?ch=cancel"> 
<input type="hidden" name="notify_url" id="notify_url" value="http://localhost/paypal.php?ch=ipn"> 
<input type="image" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_GB/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online."> 
<img alt="" border="0" src="https://www.sandbox.paypal.com/WEBSCR-640-20110429-1/en_GB/i/scr/pixel.gif" width="1" height="1"> 

paypal.php

<? 

include('db_connect.php'); 

$choice=isset($_GET['ch'])?$_GET['ch']:''; 


switch($choice){ 

case 'return': 
     print "Thank You For Buying this product,Please Visit Again,If is there any complements Then suggest us.."; 
    break; 
case 'ipn': 
    $sql="INSERT INTO paypal(add_date) VALUES(now())"; 
    mysql_query($sql); 

    $x = fopen('test1.txt','w+'); 
    $str2 = 'post data:dfydfhgfhjg'; 
    foreach($_POST as $k=>$v){ 
     $str2 .= $k.'--'.$v; 
    } 
    fwrite($x,$str2); 
    fclose($x); 

    break; 
case 'cancel': 
     print "Thank You for visiting this site,Please inform your friend to buy products through paypal which is easy service... "; 
    break; 
} 
?> 
+0

你好,你能描述一下你在paypal_form.php中寫的東西嗎?假設哪些參數在PAYNOW按鈕上發佈?謝謝。 – Chandresh

+0

Ipsita Rout,你已經提出了6個問題,但沒有給予任何人正確的答案。你能否確保你可能會獎勵那些花時間爲你提供正確答案的人?這不僅僅是針對這個問題,還包括過去幾周你提交的所有其他問題。 – Robert

回答

2

的IPN腳本不能駐留在本地主機,因爲貝寶將開放其自己的連接到它從他們身邊。改用FQDN。

+0

感謝Robert.Actually我試圖在本地xampp服務器上運行我的代碼。但是當我在外部服務器上運行它時,它提供了所需的輸出。非常感謝 –