具有可变/动态价格的 Paypal 立即购买按钮
Posted
技术标签:
【中文标题】具有可变/动态价格的 Paypal 立即购买按钮【英文标题】:Paypal Buy Now button with variable/dynamic price 【发布时间】:2017-12-09 06:36:55 【问题描述】:这不是 this post 的副本。
我引用链接的帖子:
截至 2017 年 6 月 29 日,我认为这不起作用。 Paypal 再次更改了规则,我认为它不再接受表单提交中的隐藏 html 字段:它们必须在 Paypal 的按钮编辑器中设置。
Paypal 文档一团糟。一半的链接已损坏,另一半的链接指向文档索引。
有没有人知道如何实现一个我可以动态设置价格的 Paypal 付款按钮?
【问题讨论】:
【参考方案1】:PayPal 建议使用 Express checkout 客户端集成,您可以将金额从您的网站动态发送到 PayPal 代码。
请参阅以下链接以了解 PayPal Express 结账客户端集成:
https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/client-side-REST-integration/
https://developer.paypal.com/demo/checkout/#/pattern/client
其他,请尝试使用下面的 PayPal HTML 按钮代码。
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="Yourbusinessemail@paypal.com"> <!-- Add your PayPal Seller/Business email address Required-->
<!-- 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=""> <!-- Add Description e.g your room type Required-->
<input type="hidden" name="amount" value=""> <!-- Dynamically add Total Amount Required-->
<input type="hidden" name="currency_code" value=""> <!-- Update to your currency -->
<input id="invoice" type="hidden" value="" name="invoice"> <!-- Add Unique invoice for each transaction -->
<input type="hidden" name="notify_url" value="www.yourwebsite.com/ipn.php"> <!-- Please add IPN URL You can use this service to automate back-office and administrative functions, including fulfilling orders, tracking customers, and providing status and other information related to transactions. -->
<input type='hidden' name='cancel_return' value='' /> <!-- Take customers to this URL when they cancel their checkout -->
<input type='hidden' name='return' value='' /> <!-- Take customers to this URL when they finish their checkout -->
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" >
</form>
HTML Variables - https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
Buy Now button - https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/buy_now_step_1/
IPN - https://developer.paypal.com/docs/classic/ipn/gs_IPN/
IPN - https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSetup/
IPN Sample: https://github.com/paypal/ipn-code-samples
【讨论】:
为我工作,item_name
除外。【参考方案2】:
<form name="_xclick" method="post" action= "https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="xxx@jjdj.com">
<input type="hidden" name="item_name" value="XXXX">
<input type="hidden" name="notify_url" value="http://XXXXXXX.com/ipn.php" />
<input type="hidden" id="buybuttonid" name="custom" value="XXXXX" />
<input type="hidden" name="amount" value="amount that you want to send">
<input type="submit" value="Buy Now">
</form>
请使用此按钮,请勿传递商品编号和数量,否则不会动态设置数量。
只需创建简单的立即购买按钮,并在创建按钮时将价格/金额值设为空白
【讨论】:
以上是关于具有可变/动态价格的 Paypal 立即购买按钮的主要内容,如果未能解决你的问题,请参考以下文章