哪个 PayPal 按钮最适合这种情况?

发布于 2024-10-18 00:41:24 字数 669 浏览 2 评论 0原文

我的客户有一个销售一些电子消耗品(例如电池)的网站,目前有不到 20 种产品,对于每种产品,他在他的 PayPal 帐户中创建了一些托管按钮,然后复制 html 并粘贴到该产品的页面中,如下所示

: 1 件仅需 5 美元 [购买]
购买 5 个仅需 23 美元 [购买]
以 45 美元购买 10 件 [购买]

现在,他希望允许客户输入要购买的商品数量,并希望系统在考虑折扣的情况下为他/她计算价格。

例如,客户输入17,然后显示他/她需要支付的价格,

购买 [17] 的价格为 $45+$23+($5x2)=$78 [购买]

我可以使用 javascript 进行此计算并将其显示在产品页面中,但我需要使其与 PayPal 正确交互。

我已经用谷歌搜索过,我想我需要使用 按钮管理器 API加密按钮明文按钮可能是我所需要的。

但对于这种情况,哪一个更好呢?实现应该尽可能简单。

请各位指教。

提前致谢。

My client has a website selling some electronic consumables (e.g. batteries), there are currently under 20 products and for each product, he has created some hosted buttons in his PayPal account and copied the html and pasted in that product's page, like this:

Buy 1 for $5 [Buy]
Buy 5 for $23 [Buy]
Buy 10 for $45 [Buy]

Now, he wants to allow the customers to enter the number of items to buy, and would like the system to calculate price for him/her taking the discount into consideration.

For example, a customer enters 17, it then shows the price he/she needs to pay,

Buy [17] for $45+$23+($5x2)=$78 [Buy]

I can use javascript to do this calculation and display it in the product page, but I need to make it interact with PayPal correctly.

I have googled and I think I need to make use of the Button Manager API, Encrypted buttons and Clear text buttons are possibly what I need.

But which one is better for this situation? The implementation should be as simple as possible.

Please kindly advise.

Thanks in advance.

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

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

发布评论

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

评论(2

久随 2024-10-25 00:41:24

最简单的解决方案是生成您自己的付款 URL 并将购买图形/表单链接到该 URL,而不是使用 PayPal 按钮。

https://www.paypal.com/cgi-bin/webscr?
  cmd=_ext-enter
  &redirect_cmd=_xclick
  &business=YOUR_EMAIL
  &item_name=ITEM_NAME
  &item_number=ITEM_NUMBER
  ¤cy_code=USD
  &amount=12345.67
  &shipping=0
  &tax=0
  &return=RETURN_URL
  &cancel_return=CANCEL_URL
  ¬ify_url=IPN_URL

PayPal

只需根据需要替换值即可。您需要编写一个 IPN 脚本来接收通知回发并在每次付款进入时更新他的订单数据库,这也是您验证链接未被用户篡改的地方(如果付款金额不匹配)产品的数量等)。

The simplest solution is to generate your own payment URLs and link a buy graphic/form to that URL, rather than use a PayPal button.

https://www.paypal.com/cgi-bin/webscr?
  cmd=_ext-enter
  &redirect_cmd=_xclick
  &business=YOUR_EMAIL
  &item_name=ITEM_NAME
  &item_number=ITEM_NUMBER
  ¤cy_code=USD
  &amount=12345.67
  &shipping=0
  &tax=0
  &return=RETURN_URL
  &cancel_return=CANCEL_URL
  ¬ify_url=IPN_URL

PayPal

Just replace the values as needed. You'll want to write an IPN script to take the notification postbacks and update his order database as each payment comes in, which is also where you verify the link wasn't tampered with by the user (if the payment amount doesn't match the amount the products should be for, etc).

不可一世的女人 2024-10-25 00:41:24

我已经通过几种不同的方式实现了 PayPal 交互,我发现功能丰富且仍然相对容易实现之间的最佳平衡是名称值对 (NVP) API。使用填充了必要参数的 HTTP 请求将参数发送到 PayPal 服务器。有关 NVP API 的概述,请参阅此处< /a>.

使用此 API 的应用程序需要向 PayPal 发送 3 条消息:

  1. SetExpressCheckout 启动用户结帐
  2. GetExpressCheckoutDetails 从 PayPal 获取完成付款所需的付款人 ID
  3. DoExpressCheckoutPayment 完成交易

I've implemented PayPal interactions a few different ways, and the best balance I've found between feature-filled and still relatively easy to implement is the Name-Value Pair (NVP) API. Parameters are sent to PayPal servers using an HTTP request populated with the necessary parameters. An overview of the NVP API is available here.

An application using this API needs to send 3 messages to PayPal:

  1. SetExpressCheckout to initiate the user's checkout
  2. GetExpressCheckoutDetails to get the payer's ID from PayPal necessary to complete the payment
  3. DoExpressCheckoutPayment to complete the transaction
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文