1.sandbox下payment status爲pending,pending reason爲payment review 解決辦法: 這個緣由是買方或賣房開啓了付款審覈,將付款審覈關閉,payment status就會變成Completed 在http://developer.paypal.com/ 登錄 在Dashboard頁面的左側菜單中點擊Sandbox的Accounts 編輯買方或者賣方的我的設置Profile 選擇settings,把payment review的設置改爲off 2.有的空間不支持fsockopen函數,能夠使用pfsockopen函數 $fp = pfsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 60); 網址是www.sandbox.paypal.com,端口號是80,不是443 通過反覆測試,pfsockopen應該使用ssl網址,而且端口是443 $fp = pfsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 60); 3.paypal身份標記得到 在paypal用戶中心,點擊個人銷售工具-》網站習慣設定-》更新 將網站付款的自動返回設置成自動返回,並輸入返回url地址 並把付款數據傳輸設置成開啓 設置完畢,返回,再從新點擊更新,能夠在付款數據傳輸下邊找到身份標記 www.daurkuu.com/paypal/return.php 商家名稱: firstYh lastYh 安全的商家帳號 A3UN44WEK54L4 身份標記:Qoc5A3z7roYZu_nU-LdCOPj80OTlcUST1zwrUExom1ycWuJM1l8STyTi6Hi 4.paypal驗證返回值是以下狀況: HTTP/1.0 302 Found Location: https://www.sandbox.paypal.com Server: BigIP Connection: close Content-Length: 0 fsockopen使用ssl網址,而且端口號爲443, $header應該以下拼接 $header ="POST /cgi-bin/webscr HTTP/1.1\r\n"; $header .="Content-Type: application/x-www-form-urlencoded\r\n"; $header .="Host: www.sandbox.paypal.com\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n"; $header .="Connection: close\r\n\r\n"; 再次測試,成功經過 注意:檢驗總價時,應該將價格乘上100變成整數,浮點數進行比較會出現錯誤