网页集成paypal支付

在网站中集成paypal支付有两种方式:

1、通过paypal账户的按钮创建工具

进入paypal 商户账号,选择创建按钮工具,有包括添加到购物车、购买、租用三类按钮。

之后会生成一段代码,直接将代码拷贝进自己的html文件就可以了,点击按钮后会跳转到paypal相应的页面。支付流程如下:

2、直接用html的form表单,官方示例如下:

    <div role="main" class="ui-content">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">

<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="herschelgomez@xyzzyu.com">

<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">

<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Hot Sauce-12oz Bottle">
<input type="hidden" name="amount" value="5.95">
<input type="hidden" name="currency_code" value="USD">

<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif"
alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1"
src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >

</form>

结论:

总体上说paypal的集成比较简单,方式1,更加安全简便,但劣势是如果产品经常变更,或者存在多商户就非常麻烦,因为按钮的参数都是固定的。

而第二种,就与android sdk比较类似,需要将购物信息传递至后台,然后再跳转支付。

备注:paypal也支付通过交易流水号进行退款(refund)

原文地址:https://www.cnblogs.com/Fredric-2013/p/4672319.html