这是我的贝宝形式.谢谢
`<form action="https://sandBox.paypal.com/cgi-bin/webscr" method="post"> <input type="hIDden" name="business" value="savife_1314264698_biz@gmail.com "> <input type="hIDden" name="cmd" value="_xclick-subscriptions"> <input type="hIDden" name="item_name" value="Alice's Weekly Digest"> <input type="hIDden" name="item_number" value="DIG Weekly"> <input type="hIDden" name="currency_code" value="USD"> <input type="hIDden" name="notify_url" value="http://localhost/check.PHP"> <input type="hIDden" name="return" value="http://Google.co.in"> <input type="hIDden" name="a3" value="5.00"> <input type="hIDden" name="p3" value="1"> <input type="hIDden" name="t3" value="M"> <!-- display the payment button. --> <input type="image" name="submit" border="0" src="btn_subscribe_LG.gif" alt="PayPal - The safer,easIEr way to pay online"> <img alt="" border="0" wIDth="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif" > </form>解决方法 请仔细阅读:
您想要的是PAYPAL IPN,即时付款通知,在付款完成后发送到用户的网站.
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro
或者您也可以在购物车中设置IPN路径,paypal将发送通知,如下所示:
<input type="hIDden" name="notify_url" value="site.com/ipn/index.PHP" /><input type="hIDden" name="return" value="site.com/ipn/index.PHP"/>
但是您需要在paypal上登录您的商家帐户才能手动指定ipn和自动返回网址.在配置文件选项卡下的网站付款首选项和即时付款通知部分
我已经添加了成功付款后发送到您网站的示例ipn代码:
// read the post from PayPal system and add 'cmd'$req = 'cmd=_notify-valIDate';foreach ($_POST as $key => $value) {$value = urlencode(stripslashes($value));$req .= "&$key=$value";}// post back to PayPal system to 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.sandBox.paypal.com',443,$errno,$errstr,30);// assign posted variables to 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 the payment_status is Completed// check that txn_ID has not been prevIoUsly processed// check that receiver_email is your Primary PayPal email// check that payment_amount/payment_currency are correct// process payment}else if (strcmp ($res,"INVALID") == 0) {// log for manual investigation}}fclose ($fp);}?>
您需要在通知网址页面上添加此代码.您在购物车的通知网址字段中提到的返回页面,即
<input type="hIDden" name="notify_url" value="site.com/ipn/index.PHP" />
将此代码放在site.com/ipn/index.PHP中
让我们举一个购物车的例子:
<form action="https://sandBox.paypal.com/cgi-bin/webscr" method="post"> <input type="hIDden" name="business" value="savife_1314264698_biz@gmail.com "> <input type="hIDden" name="cmd" value="_xclick-subscriptions"> <input type="hIDden" name="item_name" value="Alice's Weekly Digest"> <input type="hIDden" name="item_number" value="DIG Weekly"> <input type="hIDden" name="currency_code" value="USD"> <input type="hIDden" name="notify_url" value="http://localhost/check.PHP"> <input type="hIDden" name="return" value="http://Google.co.in"> <input type="hIDden" name="a3" value="5.00"> <input type="hIDden" name="p3" value="1"> <input type="hIDden" name="t3" value="M"> <!-- display the payment button. --> <input type="image" name="submit" border="0" src="btn_subscribe_LG.gif" alt="PayPal - The safer,easIEr way to pay online"> <img alt="" border="0" wIDth="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif" > </form>
在这种情况下,paypal将发送ipn的通知URL是http://localhost/check.PHP.
所以将该代码放在check.PHP页面中.收到ipn后,您可以进一步使用它进入您的数据库等.
或者访问此链接以获取paypal ipn Listener的概述:
https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNImplementation
希望这可以帮助.
总结以上是内存溢出为你收集整理的html – 整合paypal全部内容,希望文章能够帮你解决html – 整合paypal所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)