可能重复:
Paypal 中带有导轨的无效商家配置
我正在玩 Active Merchant gem。我使用Rails cast(144)并创建了一个 ruby 文件 ( credit_card.rb
):
require "rubygems"
require "active_merchant"
ActiveMerchant::Billing::Base.mode = :test
gateway = ActiveMerchant::Billing::PaypalGateway.new(
:login => "seller_1316503855_biz_api1.agileblaze111.com",
:password => "********",
:signature => "A5llddES-nIiDc8WBuZMOtm6yM2oANQrerVY20ty0ZxeN-izmKjwDtR0"
)
credit_card = ActiveMerchant::Billing::CreditCard.new(
:type => "visa",
:number => "4234609806354393",
:verification_value => "123",
:month => '9',
:year => '2016',
:first_name => "shamith",
:last_name => "c"
)
billing_address = {
:name => "John Smith",
:address1 => '123 First St.',
:address2 => '33333',
:city => 'Los Angeles',
:state => 'CA',
:country => 'US',
:zip => '90068',
:phone => '310-555-1234'
}
billing_address1 = {
:name => 'Test User',
:company => '',
:address1 => '123 S Main St',
:address2 => '',
:city => 'Akron',
:state => 'OH',
:country => 'US',
:zip => '44333',
:phone => '(310)555-5555'
}
if credit_card.valid?
puts "Credit Card is valid"
response=gateway.purchase(1000,credit_card,:ip=>"127.0.0.1",:billing_address=>billing_address1)
if response.success?
puts "Purchased"
else
puts "Error:#{response.message}"
end
else
puts "Error: credit card is not valid. #{credit_card.errors.full_messages.join('. ')}"end
我执行$ ruby credit_card.rb
并收到以下错误:
Error: This transaction cannot be processed due to an invalid merchant configuration.