Hi
I am trying to get up and running using active merchant and have been
following the article <a
href="http://www.actsasflinn.com/articles/2007/02/27/ruby-on-rails-credit-card-processing-with-active-merchant">here</a>
I have set up all of my sandbox accounts, downloaded the certificates
and pulled in all of the login info supplied by the sandbox account but
for some reason I keep getting "StandardError in
OrderController#checkout - Username/Password is incorrect" ... although
I am pretty sure that is not the case.
My controller looks like this
----------------------------------------------------------------------------
class OrderController < ApplicationController
def checkout
creditcard = ActiveMerchant::Billing::CreditCard.new(
:type => ''visa'',
:number => ''the number supplied by paypal'',
:month => 1,
:year => 2010,
:first_name => ''Test'',
:last_name => ''User''
)
params = {
:address => {
:name => ''Test User'',
:address1 => ''1 Main St'',
:city => ''San Jose'',
:state => ''CA'',
:zip => ''95131'',
:country => ''US'',
:phone => ''415-222-2222''
},
:ip => ''127.0.0.1''
}
if creditcard.valid?
# Create a gateway object to the Paypal service
gateway ActiveMerchant::Billing::PaypalGateway.new(:login =>
''mysandboxAPIusername'', :password =>
''mysandboxAPIpassword'')
# Authorize for 10 dollars (1000 cents)
response = gateway.authorize(1000, creditcard, params)
if response.success?
# Capture the money right away
gateway.capture(1000, response.authorization)
render :text => ''Hazaa!''
else
raise StandardError, response.message
end
end
end
end
----------------------------------------------------------------------------
I also have this in my enviroment.rb
# Ensure the gateway is in test mode
ActiveMerchant::Billing::Base.gateway_mode = :test
# Install the key
ActiveMerchant::Billing::PaypalGateway.pem_file File.read(File.join(RAILS_ROOT,
''config'', ''paypal'',
''test.pem''))
----------------------------------------------------------------------------
does anyone have any idea why this is happening? any help would be
really appreciated.
you can see the page that is throwing the error here
http://railsquid.no-ip.org:3000/order/checkout
cheers guys,
Graham
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---