ActiveMerchant需要引脚吗?

时间:2011-10-23 16:26:48

标签: ruby-on-rails ruby credit-card activemerchant

我在像这样的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 Library的初始化程序,我看到登录但不是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)

但仍然没有

1 个答案:

答案 0 :(得分:1)

也许你需要将授权引脚传递给交易。您可以将代码粘贴到您调用交易的地方吗?

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

修改

我认为ActiveMerchant没有实现引脚功能。您可以选择以下选项:

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

  3. 然后你可以打电话:

    ::GATEWAY = ActiveMerchant::Billing::UsaEpayGateway.new(
        :login => "SOMEKEY",
        :pin => "PIN"
    )