2015-09-15 42 views
2

我在我的電子商務網站上有一個用於CC處理的Authorize.net帳戶,我使用ActiveMerchant來驗證事務。它一直很好,直到前一陣子,然後停止。我無法弄清楚爲什麼。當我在測試模式下運行它時,它工作正常,創建交易併成功授權資金。但是當我用真實賬戶嘗試時,它失敗了。當我從控制檯運行它,這裏是代碼:rails activemerchant authorize.net問題

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 

當我在測試模式下運行它,在我的沙盒帳戶(兩行以上代碼中註釋掉) - 它工作正常。當我在真實賬戶上運行它時(代碼如上所示) - 出現錯誤:「處理期間發生錯誤,請致電Merchant Service Provider。」完整的迴應散列是:

#<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?測試返回true。

當我查看Authorize.net中的事務時,我看到所有已創建的事務和所有信息都正確,但事務代碼是General Error。

任何想法?非常感謝,我在這裏結束了我的繩索並迅速下沉。

回答

0

您的產品Authorize.net處於測試模式嗎?否則,Donanld Duck將無法使用假信用卡結賬。

您應該可以登錄到您的生產Authorize.net帳戶,並將測試訂單視爲下降。如果你這樣做,那麼一切正常,你將需要測試一張真正的卡,以獲得成功的交易。如果您想用假卡片進行測試,則需要將生產帳戶重新設置爲測試。

相關問題