PayPal贝宝集成

今天在集成PayPal贝宝在线支付功能时,遇到了一些小挫折,费了不少功夫才最终解决(贝宝的技术支持确实让我很想吐槽)。现在记录下来,供后来者参考。根据集成说明文档,我们写的测试demo如下: 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>   
    <title>Test paypal</title>   
</head>
    <body>
        <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
            <div>            
                <label>充值100美元</label>
                <input type="hidden" name="amount" value="100"/>   
                <input type="hidden" name="cmd" value="_s-xclick"/>           
                <input type="hidden" name="business" value="yourname@gmail.com"/>          
                <input type="hidden" name="item_name" value="Charge" />            
                <input type="hidden" name="currency_code" value="USD" />                     
                <input type="hidden" name="return" value="http://www.****.com/payReturn.aspx"/>
                <input type="hidden" name="notify_url" value="http://www.****.com/paypalNotify.aspx" /> 
                <input type="image" src="https://www.paypalobjects.com/zh_XC/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal——最安全便捷的在线支付方式!"/>
                <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
            </div>
        </form>
    </body>
</html>

 类似这样的代码测试很多次,当跳转到贝宝的页面时,金额100没有传递过去,截图如下所示:

后来,经过摸索,发现需要将cmd项的值修改一下,如下所示: 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>   
    <title>Test paypal</title>   
</head>
    <body>
        <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
            <div>            
                <label>充值100美元</label>
                <input type="hidden" name="amount" value="100"/>   
                <input type="hidden" name="cmd" value="_xclick"/>           
                <input type="hidden" name="business" value="yourname@gmail.com"/>          
                <input type="hidden" name="item_name" value="Charge" />            
                <input type="hidden" name="currency_code" value="USD" />                     
                <input type="hidden" name="return" value="http://www.****.com/payReturn.aspx"/>
                <input type="hidden" name="notify_url" value="http://www.****.com/paypalNotify.aspx" /> 
                <input type="image" src="https://www.paypalobjects.com/zh_XC/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal——最安全便捷的在线支付方式!"/>
                <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"/>
            </div>
        </form>
    </body>
</html>

  这样就可以将金额传递到贝宝的页面了。

 

转载于:https://www.cnblogs.com/justnow/p/3268218.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值