【问题标题】:rails activemerchant authorize.net problemsrails activemerchant authorize.net 问题
【发布时间】:2015-12-11 06:59:56
【问题描述】:

我有一个 Authorize.net 帐户,用于在我的电子商务网站上进行抄送处理,并且我使用 ActiveMerchant 来验证交易。直到不久前它工作得很好,然后就停止了。我不知道为什么。当我在测试模式下运行它时,它工作正常,创建交易并成功授权资金。但是当我尝试使用真实账户时,它失败了。当我从控制台运行它时,代码如下:

cc_hash =
  :first_name         => 'Donald',
  :last_name          => 'Duck',
  :number             => '4007000000027',
  :month              => '8',
  :year               => Time.now.year+1,
  :verification_value => '000'
}
card = ActiveMerchant::Billing::CreditCard.new(cc_hash)

#--- valid?
RYeller.bar
if card.valid?
  puts "card valid"
else
  puts "card not valid"
end

#ActiveMerchant::Billing::Base.mode = :test
#gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(:login=>'scrubbed',:password=>'scrubbed')

ActiveMerchant::Billing::Base.mode = :production
gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(:login=>'scrubbed',:password=>'scrubbed')

amount  = rand(1000)+2500 
options = {}
options[:order_id]    = "WEBSITE 26"
options[:description] = 'WEBSITE TEST'

#--- authorize transaction
response = gateway.authorize(amount, card, options)
puts response.inspect

当我在测试模式下运行它时,在我的沙盒帐户中(上面代码中注释掉的两行) - 它工作正常。当我在我的真实帐户上运行它时(代码如上) - 我收到一个错误:“处理过程中发生错误。请致电商家服务提供商。”完整的响应哈希是:

#<ActiveMerchant::Billing::Response:0x1078607d8 @fraud_review=false, @params={"response_reason_code"=>"35", "avs_result_code"=>"P", "transaction_id"=>"scrubbed", "response_code"=>2, "response_reason_text"=>"An error occurred during processing. Call Merchant Service Provider.", "card_code"=>"P"}, @message="An error occurred during processing. Call Merchant Service Provider", @authorization="scrubbed", @test=false, @cvv_result={"message"=>"Not Processed", "code"=>"P"}, @success=false, @avs_result={"message"=>"Postal code matches, but street address not verified.", "street_match"=>nil, "postal_match"=>"Y", "code"=>"P"}>

我正在使用测试 CC 编号和 card.valid?测试返回真。

当我查看 Authorize.net 中的交易时,我看到了所有已创建的交易和所有正确的信息,但交易代码是一般错误。

有什么想法吗?非常感谢您的帮助,我已经走到了尽头,并且正在快速下沉。

【问题讨论】:

    标签: ruby-on-rails transactions authorize.net activemerchant


    【解决方案1】:

    您的产品 Authorize.net 是否处于测试模式?否则,唐老鸭将无法使用假信用卡结账。

    您应该能够登录到您的生产 Authorize.net 帐户并将测试订单视为拒绝。如果您这样做,那么一切正常,您需要使用真实卡进行测试才能成功交易。如果您想使用假卡进行测试,则需要将您的生产帐户重新设置为测试。

    【讨论】:

      猜你喜欢
      • 2011-05-25
      • 2011-02-11
      • 2011-10-20
      • 2013-08-01
      • 2017-08-06
      • 2011-10-13
      • 2015-03-25
      • 2011-06-14
      • 2011-11-18
      相关资源
      最近更新 更多