使用 PHP 和 MySql 将 Paypal 与我的后端集成

发布于 2024-12-12 04:30:24 字数 254 浏览 0 评论 0原文

我想使用网站付款标准集成贝宝。我有2个需求。

首先,用户可以从我网站上影响价格的选项 3 下拉列表中进行选择。价格会根据从后端服务器查找正确值而选择的选项而变化。当用户选择“立即购买”按钮时,它应该选择正确的价格和表单中选择的正确选项(显示用户选择的选项)。

其次,交易完成并验证后用户支付的价格应从我后端(来自服务器)的“库存”金额中扣除。

如何使用 Paypal 获得这 2 项功能?这是我应该使用付款数据传输的地方吗(至少对于第二个问题)?

I'd like to integrate paypal using Website Payments Standard. I have 2 needs.

First, a user can pick from options 3 dropdowns on my site that impacts the price. The price changes depending on the option selected by looking up the correct value from the server on the back-end. When a user selects the "Buy Now" button, it should pick up the right price and the right options selected in the form (the one's displayed that the user has chosen).

Second, the price the user pays once the transaction has been completed and verified should be deducted from an "Inventory" amount on my back-end (from the server).

How do I get these 2 capabilities using Paypal? Is this something where I should use Payment Data Trasfer (at least for the 2nd question)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遗失的美好 2024-12-19 04:30:24

你是对的,动态定价和库存管理是捆绑在一起的。

关于动态定价,您可以使用常规 PayPal“立即购买”按钮来完成此操作。转到您的 PayPal 帐户并创建一个新的“立即购买”按钮。您需要禁用“PayPal 的保存按钮”复选框,然后在生成代码时,您可以“取消保护”该按钮以公开各个字段,包括商品价格。然后,您可以根据服务器或浏览器的计算来更新价格。

由于定价和库存是捆绑在一起的,因此取消单击“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 Business Code here...">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="item_name" value="Widgets">
<input type="hidden" name="item_number" value="12345">
<input type="hidden" name="amount" value="20.00">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

You're right, dynamic pricing and inventory management are bundled together.

Regarding dynamic pricing you can do this with the regular PayPal "Buy Now" button. Go to your PayPal account and create a new "Buy Now" button. You'll need to disable the "Save button at PayPal" checkbox, then when you generate your code you can "unprotect" the button to expose the individual fields, including the item price. You can then update the price based on a server or browser calculation.

Because pricing and inventory are bundled, un-clicking the "Save button at PayPal" disables inventory functions as well.

Finally, beware that un-protecting the "Buy Now" code allows a "bad guy" to change the price of your product browser side (the same way you are), so you'll need to perform additional verification on your orders.

Here's a sample of the un-protected "Buy Now" button code. Use the "amount" field to update

<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 Business Code here...">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="item_name" value="Widgets">
<input type="hidden" name="item_number" value="12345">
<input type="hidden" name="amount" value="20.00">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文