活跃商户信用卡号码问题
我实施了贝宝快速结账并且工作正常,但我不得不将其更改为网站支付专业版。我切换到网站支付专业版并设置了所需的一切,但始终显示“无效的信用卡号”作为错误消息。
我的 development.rb
文件包含以下代码,
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(
:login => "seller_1280588868_biz_api1.hotmail.com",
:password => "1290567879",
:signature => "AZjEOuZ30SjjtX25uAhHyqYeodXnAi.tdG6i-gpZB1dBn2t876XYhKdE2"
)
我使用下面的代码来生成信用卡并验证
def validate_card
unless credit_card.valid?
credit_card.errors.full_messages.each do |message|
errors.add_to_base message
end
end
end
def credit_card
@credit_card ||= ActiveMerchant::Billing::CreditCard.new(
:first_name => first_name,
:last_name => last_name,
:type => card_type,
:number => card_number,
:verification_value => card_verification,
:month => card_expires_on.month,
:year => card_expires_on.year
)
end
我真的不明白为什么会出现此错误。我认为我做的一切都是正确的。我已输入 paypal 的沙盒帐户信用卡号。
我使用的是 Rails 3.0.0、Ruby 1.9.2 和 Active Business 1.12.0。
I implemented paypal express checkout and was working fine but I had to change it to website payment pro. I switched to website payment pro and setup everything that needed but always displays "invalid credit card number" as an error message.
My development.rb
file has below code
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(
:login => "seller_1280588868_biz_api1.hotmail.com",
:password => "1290567879",
:signature => "AZjEOuZ30SjjtX25uAhHyqYeodXnAi.tdG6i-gpZB1dBn2t876XYhKdE2"
)
I have used below code to generate credit card and validate
def validate_card
unless credit_card.valid?
credit_card.errors.full_messages.each do |message|
errors.add_to_base message
end
end
end
def credit_card
@credit_card ||= ActiveMerchant::Billing::CreditCard.new(
:first_name => first_name,
:last_name => last_name,
:type => card_type,
:number => card_number,
:verification_value => card_verification,
:month => card_expires_on.month,
:year => card_expires_on.year
)
end
I really don't understand why this error is coming. I think i did everything correctly. I have entered paypal's sandbox account credit card number.
I am using rails 3.0.0, ruby 1.9.2 and active merchant 1.12.0.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
花了半天时间终于搞定了。该错误是我只使用了最后 4 位有效数字,而不是全部 16 位,因为 PayPal 在我的信用卡列表页面上只显示了最后 4 位数字。现在它可以工作了,因为我使用了所有 16 位数字。
感谢大家的关注/意见。
Finally got after almost spending half day on this. The bug was that I only used last 4 valid digits instead of all 16 digits because paypal displayed only last 4 digits on my credit card list page. Now it is working as I used all 16 digits.
Thank guys for your concerns/inputs.