我已经有一个完全功能的购物车解决方案。我只需要代码来传递产品名称、总价、退货地址和我的PayPal地址,以便让它指向购物车。有人能引导我正确的方向吗?
PayPal 有很多不同版本。我所了解的是我需要的叫做“PayPal 网站支付”。有人能确认一下吗?
是的,网站支付标准(Website Payments Standard) 是可行的方式。
基本上,您需要创建一个包含一些预先设置好的隐藏字段(例如金额等)的表单,然后将其提交。您甚至可以使用JavaScript提交此表单,以便将客户带到PayPal完成交易。
以下是一个示例:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="your_paypal_email_account" />
<input type="hidden" name="undefined_quantity" value="1" />
<input type="hidden" name="item_name" value="Order #1111111 for So-and-So" />
<input type="hidden" name="item_number" value="order_1111111" />
<input type="hidden" name="amount" value="5.00" />
<input type="hidden" name="shipping" value="0.00" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="cn" value="Comments" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input type="hidden" name="return" value="http://www.example.com/some-page-to-return-to" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_SM.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>
您可以在此处找到有关可用附加参数的文档:https://www.x.com/sites/default/files/pp_websitepaymentsstandard_integrationguide.pdf
<form>
标记的顶部未被粘贴。我将编辑我的答案并添加该地址。 - Bradreturn
,但我不确定。关于该选项以及沙盒信息,请查看我指向你的文档。 - Bradaction
中的https://www.paypal.com/cgi-bin/webscr替换为https://www.sandbox.paypal.com/cgi-bin/webscr。注意:您需要有一个有效的沙箱卖家账户,并登录https://developer.paypal.com/。 - Robert<input type="hidden" name="cancel_return" value="http://www.example.com/some-page-to-return-to" />
来设置用户取消付款时的返回URL。 - Maurice