I just wanted to test my paypal sandbox payment gateway in a simple way. Unfortunately I'm getting the following error message:
"This transaction cannot be processed due to an invalid merchant configuration."
This is my testfile. It's from an railscasts Episode:
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
That error means you don't have Payments Pro active on the account you're trying to process with, or you haven't accepted the billing agreement for it after turning it on.