ActiveMerchant PayPal Express 可能存在错误?

发布于 2025-01-08 01:59:45 字数 881 浏览 0 评论 0原文

我有点困惑,不知怎的,我能够更改购买的金额:

首先我设置我的购买,

@setup_response = gateway.setup_purchase(
  10*100,
  :ip                => request.remote_ip,
  :return_url        => url_for(:controller => "payments", :action => 'confirm', :only_path => false),
  :cancel_return_url => url_for(:controller => "payments", :action => 'error', :only_path => false),
  :currency => 'EUR',
  :email => current_user.email,
  :no_shipping => true,
  :items => items
)

稍后我进行购买:

  purchase = gateway.purchase(
      500*100,
      :ip       => request.remote_ip,
      :payer_id => params[:payer_id],
      :token    => params[:token],
      :currency => 'EUR'
      )

如您所见,我已将金额从 10 -> 更改为 10。安装程序/用户在购买时同意 1000,并且它在 Paypal 沙箱中确实有效。

我觉得这真的很奇怪。有人能证实这一点吗?这不应该发生吗? 这也许只能在沙盒中实现?

I am a little bit confused, somehow I am able to change the amount of the purchase:

First I setup my purchase,

@setup_response = gateway.setup_purchase(
  10*100,
  :ip                => request.remote_ip,
  :return_url        => url_for(:controller => "payments", :action => 'confirm', :only_path => false),
  :cancel_return_url => url_for(:controller => "payments", :action => 'error', :only_path => false),
  :currency => 'EUR',
  :email => current_user.email,
  :no_shipping => true,
  :items => items
)

Later I do the purchase:

  purchase = gateway.purchase(
      500*100,
      :ip       => request.remote_ip,
      :payer_id => params[:payer_id],
      :token    => params[:token],
      :currency => 'EUR'
      )

As you can see I have changed the amount from 10 -> setup/user agreed to 1000 when purchasing and it did work in the Paypal Sandbox.

I think this is really strange. Can anybody confirm this? This should not happen?
Is this perhaps only possible in the Sandbox?

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

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

发布评论

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

评论(2

哆兒滾 2025-01-15 01:59:45

可以肯定的是,Paypal Express Checkout 并不要求 DoExpressCheckoutPayment 中的金额(这是 setup_purchase 映射到的)与 SetExpressCheckout 中的金额相同。引用 Paypal 文档

在最简单的情况下,您可以在以下情况下设置订单总金额:
调用 SetExpressCheckout API。但是,您可以更改金额
如果您不知道,请在调用 DoExpressCheckoutPayment API 之前
您调用 SetExpressCheckout API 时的总金额。

Pretty sure Paypal Express Checkout does not require the amount at DoExpressCheckoutPayment (which is what setup_purchase maps to) to be the same as that at SetExpressCheckout. To quote Paypal's documentation:

In the simplest case, you set the total amount of the order when you
call the SetExpressCheckout API. However, you can change the amount
before calling the DoExpressCheckoutPayment API if you did not know
the total amount when you called the SetExpressCheckout API.

洛阳烟雨空心柳 2025-01-15 01:59:45

您在设置和购买之间有一些回旋余地 - 这是为了允许人们更改订单、折扣等。

不要冒险向人们收取的费用超出您明确规定的金额 - Paypal 很快就会给人们退款所以从长远来看你最终会失败。

You are allowed some leeway between the set-up and the purchase - this is to allow people changing their order, discounts, etc.

Don't take the risk of billing people more than you clearly state - Paypal are very quick to give people refunds so you'll end up losing out in the long run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文