我有一个Web应用程序,我想将PayPal Sandox集成到其中。
这样做的步骤是什么?
由于对于初学者来说,PayPal的集成指南可能不清楚,而对于简单的结帐实施而言,其他在线教程的时间可能太长,因此本问答旨在将PayPal Sandbox快速,轻松地集成到您的Web应用程序中。无需外部库或其他下载。
步骤1:创建一个PayPal沙箱帐户。按照此指南创建测试帐户。
步骤2:为基本的立即购买按钮(仅用于单项付款)复制以下示例HTML代码:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="[email protected]">
<!-- 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="Your Product">
<input type="hidden" name="amount" value="25.00">
<input type="hidden" name="currency_code" value="USD">
<!-- Specify checkout options. -->
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://www.yoursite.com/paymentsuccessful.hmtl">
<input type="hidden" name="cancel_return" value="http://www.yoursite.com/paymentcancelled.hmtl">
<!-- Display the payment button. -->
<input type="image" name="submit" 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>
表单操作-值为https://www.sandbox.paypal.com/cgi-bin/webscr
,删除“沙盒”表示您正在使用在线PayPal网站
业务-不必是真实的电子邮件,在PayPal结帐页面的左上部分显示的文本
CMD -_xclick
手段按钮是点击立即购买按钮
item_name-产品名称
金额-产品价格
currency_code-在此处阅读受支持的值
no_note-不提示买家在付款中包含注释(0-假,1-真)
no_shipping-不提示买家输入送货地址(0-提示但不要求,1-不提示,2-提示并要求)
回归- URL到贝宝重定向后,他们完成他们的付款买家的浏览器
cancel_return-如果买家在完成付款前取消结帐,贝宝将重定向到该浏览器的URL
输出:
参考:
测试经典API调用(推荐阅读)
单项付款–立即购买按钮(可用的更多选项)
用于显示PayPal结帐页面的HTML变量(可用的更多选项)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句