php - 具有可变/动态价格的 Paypal 立即购买按钮

标签 php paypal paypal-rest-sdk

这不是 this post 的副本.

我引用链接的帖子:

As of June 29, 2017 I see this not working. Paypal has again changed its rules, and I don't think it any longer accepts hidden HTML fields in the form submission: they must be set in the button editor at Paypal.

Paypal 文档一团糟。一半链接已损坏,另一半链接指向文档索引。

有没有人知道如何实现我可以动态设置价格的 Paypal 支付按钮?

最佳答案

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" alt="PayPal - The safer, easier way to pay online">
</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 

关于php - 具有可变/动态价格的 Paypal 立即购买按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44928825/

相关文章:

paypal - 以美元价格表示的逗号和无句点

api - 如何以编程方式取消买方协议(protocol)? ( Paypal )

php - 查询排名 int 时获取排名

php - Twitter api 1.1 图像未显示在提要中

javascript - 在服务器端显示适合div的div内容

php - 是否可以在 <form> 标签内的 php 函数中使用 &lt;input&gt; 标签?

ruby-on-rails - 如何正确设置 Active Paypal Adaptive Payment IPN Notifications?

javascript - 如何根据环境渲染Paypal Smart Button?

paypal - 付款完成后,就称为销售?

python - 使用 Paypal Python SDK 将 PayPal 集成到 Django 应用程序中