金额无效 paypal_adaptive gem rails

Posted

技术标签:

【中文标题】金额无效 paypal_adaptive gem rails【英文标题】:The amount is invalid paypal_adaptive gem rails 【发布时间】:2012-07-18 22:35:06 【问题描述】:

我在日志控制台中收到此错误:

The amount is invalid

我在开发环境中工作,http://localhost:3000/

我的控制器中有:

def pay
 pay_request = PaypalAdaptive::Request.new
     data = 
       "returnUrl" => user_orders_url(current_user),
       "requestEnvelope" => "errorLanguage" => "en_US",
       "currencyCode" => "USD",
       "receiverList" =>
                "receiver" => [
                 "receiver"=> ["email"=>"email1", "amount"=>"10.00", "primary" => true, "email"=>"email2", "amount"=>"9.00", "primary" => false]
               ],
       "cancelUrl" => user_orders_url(current_user),
       "actionType" => "PAY",
       "ipnNotificationUrl" => ipn_notification_user_orders_url(current_user)
     
     pay_response = pay_request.pay(data)

     if pay_response.success?
         # Send user to paypal
         redirect_to pay_response.preapproval_paypal_payment_url
     else
         puts pay_response.errors.first['message']
         redirect_to root_url, alert: "Something went wrong. Please contact support."
     end
end

我做错了什么?

【问题讨论】:

【参考方案1】:

你能测试一下吗

"amount"=>10

或者

"amount"=>"10"

【讨论】:

【参考方案2】:

错误已修复:

错误在"primary" => true"primary" => false

我已经删除了这段代码,现在控制器可以正常工作了。

非常感谢!

【讨论】:

以上是关于金额无效 paypal_adaptive gem rails的主要内容,如果未能解决你的问题,请参考以下文章

gem install sqlite3 有效,捆绑安装无效?

Solidity BlockChain 无效金额检查

gem install 失败并显示“ruby:无效选项 -H(-h 将显示有效选项)(RuntimeError)”

带有 Rpush gem 的 IOS/SWIFT 推送通知:生产中的无效令牌 (8)

使用 Rails 3 的 PayPal 自适应支付

对贝宝 ipn 感到困惑和迷失方向