[英]The amount is invalid paypal_adaptive gem rails
I am receiving this error in my log console: 我在日志控制台中收到此错误:
The amount is invalid
I am working in development env, with http://localhost:3000/
我正在使用
http://localhost:3000/
在开发环境中工作
I have in my controller: 我在控制器中:
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
What am I doing bad? 我在做什么不好?
Can you test with 你可以用
"amount"=>10
Or 要么
"amount"=>"10"
The error was fixed: 错误已修复:
The error is in "primary" => true
and "primary" => false
. 错误出现在
"primary" => true
和"primary" => false
。
I have removed this code and now the controller does works fine. 我删除了此代码,现在控制器确实可以正常工作。
Thank you very much! 非常感谢你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.