[英]Rails ActiveMerchant - Paypal Express Checkout Error
I am getting this error when I call this code. 调用此代码时出现此错误。
response = EXPRESS_GATEWAY.setup_purchase(order.price_in_cents,
:ip => request.remote_ip,
:return_url => url_for(:action => :create, :only_path => false),
:cancel_return_url => root_path
)
redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token)
Error: 错误:
This transaction is invalid. Please return to the recipient's website to complete your transaction using their regular checkout flow.
To show I setup EXPRESS_GATEWAY correctly. 为了显示我正确设置了EXPRESS_GATEWAY。 code development.rb file.
代码development.rb文件。
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
:login => '*****************************',
:password => '*************',
:signature => '*******************************************************'
}
::EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)
end
Gem file 宝石文件
gem 'activemerchant', :require => 'active_merchant'
So the login, password, and sig. 因此,登录名,密码和sig。 were created in the sandbox are of paypal.
在沙盒中创建的都是贝宝。 So they should be working.
所以他们应该工作。
What should I try to get this error fixed. 我应该如何解决此错误。 Or is this Paypal's side?
还是这是贝宝的一面? Is there something wrong in the ActiveMerchant gem?
ActiveMerchant gem有什么问题吗?
UPDATE 1 更新1
After inspecting the response var, this is what I get. 检查响应变量后,这就是我得到的。
#<ActiveMerchant::Billing::PaypalExpressResponse:0x00000102402790 @params={"timestamp"=>"2012-06-29T01:30:18Z", "ack"=>"Failure", "correlation_id"=>"d1cb5dbb30425", "version"=>"72", "build"=>"3067390", "message"=>"CancelURL is invalid.", "error_codes"=>"10472", "Timestamp"=>"2012-06-29T01:30:18Z", "Ack"=>"Failure", "CorrelationID"=>"d1cb5dbb30425", "Errors"=>{"ShortMessage"=>"Transaction refused because of an invalid argument. See additional error messages for details.", "LongMessage"=>"CancelURL is invalid.", "ErrorCode"=>"10472", "SeverityCode"=>"Error"}, "Version"=>"72", "Build"=>"3067390"}, @message="CancelURL is invalid.", @success=false, @test=true, @authorization=nil, @fraud_review=false, @avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil}, @cvv_result={"code"=>nil, "message"=>nil}>
Any feedback is appreciated. 任何反馈表示赞赏。
UDPATE 2 UDPATE 2
Turns out after looking at that message above, it was the cancelURL that was invalid, so I fixed that and presto! 看到上面的消息后发现,那是cancelURL无效,所以我解决了这个问题,然后保存下来!
Thanks. 谢谢。
This error is shown when you are not properly logged into the sandbox account on paypal's site. 当您没有正确登录到贝宝网站上的沙盒帐户时,将显示此错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.