0

我在这样的 Rails 应用程序中使用 activemerchant

ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::UsaEpayGateway.new(
  :login => "SOMEKEY"
)

我不断收到这个错误代码

error_code: \"10117\"\nauth_code: \"000000\"\nstatus: Error\nerror: Transaction authentication required.\n

当我查看usaepay的错误代码 (10117) 时,我注意到我需要输入密码。这个我有,但我不知道如何实现。我在下面尝试了这两个

ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::UsaEpayGateway.new(
  :login => "SOMEKEY",
  :password => "MYPIN"
)

ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::UsaEpayGateway.new(
  :login => "SOMEKEY",
  :pin => "MYPIN"
)

我仍然得到同样的错误查看 USAEPAY 库的初始化程序,我看到登录但没有 pin

  def initialize(options = {})
    requires!(options, :login)
    @options = options
    super
   end  

...任何想法我可以如何将此图钉发送到Activemerchant

更新

这是我的交易电话

options = {
  :card_code=>self.card_verification
  :billing_address=>{
    :address1=>self.billing_address,
    :city=>self.city,
    :state=>self.state,
    :zip=>self.zip,
    :country=>"US"
  }
}
response = GATEWAY.purchase(price_in_cents, credit_card, options)

我试着这样做

options = {
  :card_code=>self.card_verification,
  :pin=>"333333",
  :billing_address=>{
    :address1=>self.billing_address,
    :city=>self.city,
    :state=>self.state,
    :zip=>self.zip,
    :country=>"US"
  }
}
response = GATEWAY.purchase(price_in_cents, credit_card, options)

但仍然没有

4

1 回答 1

1

也许您需要将授权密码传递给交易。你能把代码粘贴到你调用交易的地方吗?

例如,调用此方法:capture(money, authorization, options = {})

编辑:

我认为 ActiveMerchant 没有实现 pin 功能。以下是您的选择:

  1. 使用另一个脚本。以下是一些示例:http ://wiki.usaepay.com/developer/ruby
  2. 将此添加到您的 Gemfile:gem 'activemerchant', :git => 'git://github.com/kalinchuk/active_merchant.git'它将从我的 github 帐户安装一个 gem。我将 pin 字段添加到活动商家。

然后您可以致电:

::GATEWAY = ActiveMerchant::Billing::UsaEpayGateway.new(
    :login => "SOMEKEY",
    :pin => "PIN"
)
于 2011-10-24T13:44:36.483 回答