2012-02-20 227 views
0

我已經將貝寶與我的網站集成,但它確實需要付款,但它不會發送任何IPN到我的PHP文件,它應該更新我的數據庫.... 有代碼我一直使用: 調用paypal IPN不發送任何通知

session_start(); 
if($mode=='live') 
{ 
    $url=" https://www.paypal.com/cgi-bin/webscr"; 
    $email="[email protected]"; 
    $_SESSION['url']=$url; 
    $_SESSION['email']=$email; 
    $_SESSION['subtotal']=$subtotal; 
} 
else if($mode=='sandbox') 
{ 
    $url= "https://www.sandbox.paypal.com/cgi-bin/webscr"; 
    $email="[email protected]"; 
    $_SESSION['url']=$url; 
    $_SESSION['email']=$email; 
    $_SESSION['subtotal']=$subtotal; 
} 
?> 

       <form action="<?php echo $url; ?>" method="post"> 
       <input type="hidden" name="cmd" value="_xclick"/> 
       <input type="hidden" name="business" value="<?php echo $email; ?>"/> 
       <input type="hidden" name="item_name" value="shopping cart"/> 
       <input type="hidden" name="currency_code" value="GBP"/> 
       <input type="hidden" name="amount" value="<?php echo $subtotal;?>"/> 
       <input type="hidden" name="return" value="<?php echo SITE_URL; ?>"/> 
       <input type="hidden" name="cancel_return" value="<?php echo SITE_URL."/shoppingCart.php" ?>"/> 
       <input type="hidden" name="notify_url" value="php url" /> 
       <input type="hidden" name="rm" value="2"/> 
       <input type="hidden" name="custom" value="<?php echo $customer_ID;?>"/> 
       <input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"/> 
       </form> 

和PHP代碼

從PHP IPN示例代碼

.....

+1

www.paypal.com>歷史> IPN歷史>這是什麼意思? (注意:如果您看不到「IPN歷史記錄」,請先通過配置文件>我的銷售工具>即時付款通知首選項啓用IPN。) – Robert 2012-02-20 14:23:33

回答

0

什麼是價值:

<input type="hidden" name="notify_url" value="php url" /> 

這不應該在本地主機上,因爲PayPal會將POST數據從其服務器發送到該URL。所以localhost將無法工作。

+1

是的我一直在使用服務器URL,並且使用了IPN示例代碼在已被稱爲但沒有運氣的網址 – user1221098 2012-02-20 20:26:12

+0

查看我之前的評論。 IPN歷史上有什麼?所有消息的狀態是什麼? – Robert 2012-02-21 02:08:27

1

嘗試: 1.登錄您的PayPal帳戶 2.轉到個人主頁 - >歷史 - > IPN歷史 - >打開我的IPN 3.插入您的IPN監聽器的URL。