2014-01-21 25 views
0

我試圖使用ActiveMerchant文檔中的示例進行測試付款,並且得到的響應結果= 508,message =無效的時間戳:超出允許限制。ActiveMerchant響應錯誤:「無效的時間戳:值超出允許的限制」

這是代碼我使用:

ActiveMerchant::Billing::Base.mode = :test 

gateway = ActiveMerchant::Billing::RealexGateway.new(
      :login => 'myUsername', 
      :password => 'myPassword') 

amount = 1000 # $10.00 

credit_card = ActiveMerchant::Billing::CreditCard.new(
       :first_name   => 'Bob', 
       :last_name   => 'Bobsen', 
       :number    => 'valid card number', 
       :month    => '8', 
       :year    => '2015', 
       :verification_value => '123') 

if credit_card.valid? 
    response = gateway.purchase(amount, credit_card) 
    if response.success? 
    puts "Successfully charged $#{sprintf("%.2f", amount/100)} to the credit card #{credit_card.display_number}" 
    else 
    raise StandardError, response.message 
    end 
end 

任何人都遇到過這樣的錯誤?

感謝, 烏里

回答

2

這個錯誤意味着你在請求中發送的時間戳超過24小時過時。你能檢查服務器上的時間並確保它準確嗎?

這不是一個很好的信息 - 道歉! 歐文

相關問題