ruby-on-rails - Rails ActiveMerchant - Paypal 快速结帐错误

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

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

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 文件

gem 'activemerchant', :require => 'active_merchant'

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

我应该如何尝试修复此错误。或者这是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 无效,所以我修复了它并很快!

谢谢。

最佳答案

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

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

关于ruby-on-rails - Rails ActiveMerchant - Paypal 快速结帐错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11250738/

相关文章:

php - Paypal 自适应支付php

php - 在后端处理 Paypal 付款

Android Paypal 整合

ruby-on-rails - 需要Redmine插件

ruby-on-rails - 如何在 Linux 中设置 Ruby 环境?

ruby-on-rails - 在 sum 函数中将 nil 视为零

ruby - 将 x-www-form-urlencoded 转换为 json

ruby-on-rails-3 - Rails 3 Rails 找不到文件 'twitter/bootstrap' pt2

ruby-on-rails - `materialize' : Could not find

ruby-on-rails - Rails 6 Capistrano 部署失败 - Webpacker Assets :precompile