# Rails with Paypal Payments Pro error

**URL:** <https://www.ruby-forum.com/t/rails-with-paypal-payments-pro-error/116861>\
**Category:** Rails\
**Created:** [October 10, 2007, 3:13pm UTC](https://www.ruby-forum.com/t/rails-with-paypal-payments-pro-error/116861 "2007-10-10T15:13:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![3quid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/3/f08c70/32.png) [@3quid](https://www.ruby-forum.com/u/3quid)\
**Post date:** [October 10, 2007, 3:13pm UTC](https://www.ruby-forum.com/t/rails-with-paypal-payments-pro-error/116861/1 "2007-10-10T15:13:41Z")

</div>

Hi

I am trying to get up and running using active merchant and have been  
following the article [here](http://www.actsasflinn.com/articles/2007/02/27/ruby-on-rails-credit-card-processing-with-active-merchant)

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](http://railsquid.no-ip.org:3000/order/checkout)

cheers guys,

Graham

---

<div class="post-metadata">

**Author:** ![3quid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/3/f08c70/32.png) [@3quid](https://www.ruby-forum.com/u/3quid)\
**Post date:** [October 11, 2007, 2:24pm UTC](https://www.ruby-forum.com/t/rails-with-paypal-payments-pro-error/116861/2 "2007-10-11T14:24:29Z")

</div>

Graham D. wrote:

> I am trying to get up and running using active merchant

It looks to me like you’re trying to test against the regular Paypal  
sandbox.

Paypal Pro is a completely different system, with a completely different  
test server!

–Al Evans
