Ruby on rails 活动商户:字段比服务器允许的长度长或短

Ruby on rails 活动商户:字段比服务器允许的长度长或短,ruby-on-rails,ruby-on-rails-3,paypal,activemerchant,Ruby On Rails,Ruby On Rails 3,Paypal,Activemerchant,我正在使用activemerchant实现paypal直接支付 下面是代码 def credit_card_details credit_card = ActiveMerchant::Billing::CreditCard.new( :first_name => 'Bob', :last_name => 'Bobsen', :number

我正在使用activemerchant实现paypal直接支付 下面是代码

def credit_card_details
    credit_card = ActiveMerchant::Billing::CreditCard.new(
                :first_name         => 'Bob',
                :last_name          => 'Bobsen',
                :number             => '4242424242424242',
                :month              => '8',
                :year               => '2012',
                :verification_value => '123')

    errors.add(:expire_year, "Credit card expired") if credit_card.expired?
    errors.add(:cc_number, "invalid credit card details") unless credit_card.valid?

    if credit_card.valid?
      # Capture $10 from the credit card
      amount = 1000
      response = PAYPAL_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.inspect
      end
    end
  end
我尝试使用其他信用卡详细信息,但它导致“字段比服务器允许的长或短”此错误。所以我用活动页面中指定的cc细节替换了cc细节,但仍然不走运。
我不明白怎么了?

我想你错过了信用卡类型或分行。这两个选项中有一个已被弃用。试试看哪一个有效。由于您错过了信用卡类型,可能是字段未对齐或映射错误。

Try:card type:Visa卡号:4929929650119738 CVV2:891到期日:2015年5月(注意加载0)@pravin您有解决方案吗?