我只是想以一种简单的方式测试我的贝宝沙盒支付网关。不幸的是,我收到以下错误消息:
“由于商家配置无效,无法处理此交易。”
这是我的测试文件。它来自 railscasts 剧集:
require "rubygems"
require "active_merchant"
ActiveMerchant::Billing::Base.mode = :test
gateway = ActiveMerchant::Billing::PaypalGateway.new(
login: "bla-facilitator_api1.gmail.com",
password: "13234229172",
signature: "AFcWxY21C7fd0v3bYYYRCOSSrl31AsqKs2TwM-RkGcerk8QatsKAkfJt"
)
credit_card = ActiveMerchant::Billing::CreditCard.new(
brand: "visa",
number: "4111111111111111",
verification_value: "123",
month: 1,
year: 2014,
first_name: "Ryan",
last_name: "Bates"
)
if credit_card.valid?
response = gateway.purchase(1000, credit_card, ip: "127.0.0.1",
:billing_address => {
:name => "Ryan Bates",
:address1 => "123 Main St.",
:city => "New York",
:state => "NY",
:country => "US",
:zip => "10001"
}
)
if response.success?
puts "Purchase complete!"
else
puts "Error: #{response.message}"
end
else
puts "Error: credit card is not valid. #{credit_card.errors.full_messages.join('. ')}"
end