【问题标题】:Rails ActiveMerchant - Paypal Express Checkout ErrorRails ActiveMerchant - Paypal Express 结帐错误
【发布时间】:2012-06-30 07:59:32
【问题描述】:

调用此代码时出现此错误。

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)

错误:

This transaction is invalid. Please return to the recipient's website to complete your transaction using their regular checkout flow.

为了显示我正确设置了 EXPRESS_GATEWAY。代码开发.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 'activemerchant', :require => 'active_merchant'

所以登录名、密码和签名。在沙箱中创建的都是贝宝。所以他们应该工作。

我应该如何解决这个错误。或者这是 Paypal 的一方? ActiveMerchant gem 有什么问题吗?

更新 1

检查响应变量后,这是我得到的。

#<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}>

感谢任何反馈。

UDPATE 2

看了上面那条消息后发现,cancelURL 是无效的,所以我修复了它并立即修复!

谢谢。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 paypal activemerchant


    【解决方案1】:

    当您未正确登录到 paypal 网站上的沙盒帐户时会显示此错误。

    1. 登录http://sandbox.paypal.com/
    2. 打开您的网站并结帐
    3. 发送到贝宝后,以您的买家测试帐户之一登录

    【讨论】:

    • 我没有创建买家账户。让我测试一下,看看能不能解决问题。
    猜你喜欢
    • 2014-04-26
    • 1970-01-01
    • 2012-03-14
    • 2017-03-21
    • 2016-11-13
    • 1970-01-01
    • 2011-06-01
    • 2011-05-10
    • 2014-10-21
    相关资源
    最近更新 更多