Moving from Authorize.net to Website Payments Pro (Paypal)

33 views
Skip to first unread message

voodoorails

unread,
May 15, 2008, 12:34:28 PM5/15/08
to Active Merchant
RoR version 2.02 / ActiveMerchant 1.3.2

I'm attempting to move from authorize.net (which was working) to
Website Payments Pro - consolidating our merchant accounts to Paypal.
The configuration/verification was different, for example, ip was no
longer optional - and a buyer address is required.

Once I got that sorted out(after receiving appropriate error messages
to push me along), I'm now getting "The connection to the remote
server timed out" (both on my localhost and my production server -
public to the web, not behind a router) - without additional debugging
info that I can find :)

For authorization - I'm using the signature - not the certificate,
supplied by the sandbox in the seller accounts profile.

Looking in ActiveMerchant, I find these urls :

URLS = {
:test => { :certificate => 'https://api.sandbox.paypal.com/
2.0/',
:signature => 'https://api-3t.sandbox.paypal.com/
2.0/' },
:live => { :certificate => 'https://api-aa.paypal.com/2.0/',
:signature => 'https://api-3t.paypal.com/2.0/' }
}

I'm hoping maybe those are no longer valid? Interestingly, I was, I
thought, getting some communication from Paypal in the verification
process - but perhaps that was local - caught in pre-processing before
hitting Paypal?

I'm using SSL - and have it installed in prod. Unfortunately, the cert
is not proper - that is, the domain.com is secured - but I'm using
beta.domain.com - until I can move into prod. Hopefully I dont have to
un-install SSL to test this? This was working with Authorize.net
before :(




voodoorails

unread,
May 15, 2008, 2:22:17 PM5/15/08
to Active Merchant
After further review ... ;)

The endpoint is correct ...

https://www.paypal.com/IntegrationCenter/ic_api-reference.html
-------
API Endpoints
The API Endpoints for your API calls depend on which authentication
mechanism you use and which calling mechanism you use. The table below
summarizes all of the endpoints.
Environment Authentication Calling Endpoint
-------

Sandbox API Certificate SOAP https://api.sandbox.paypal.com/2.0/
Sandbox API Signature SOAP https://api-3t.sandbox.paypal.com/2.0/

1) some of the transactions made it to Paypal - I can see them in the
Seller transactions, just did not make it back - or my server timed
out before it could?

2) I tried using the certificate - rather than the sig. And installed
it as a PEM file, as described here.
http://www.smallroomsoftware.com/articles/2006/12/5/paypal-website-payments-pro

Cody Fauser

unread,
May 15, 2008, 3:08:47 PM5/15/08
to activem...@googlegroups.com
I think the issue may be that the PayPal sandbox is incredibly flaky
right now. On average transactions have been taking 40+ seconds for me
lately. I've also noticed a lot of people complaining the PayPal
forums.

--
Cody Fauser
http://shopify.com - e-commerce done right
http://www.codyfauser.com - blog
http://peepcode.com/products/activemerchant-pdf - ActiveMerchant PeepCode
http://www.oreilly.com/catalog/rjsrails - RJS Templates for Rails

voodoorails

unread,
May 16, 2008, 11:23:21 AM5/16/08
to Active Merchant
Ok, that makes sense - their support on the forums over there won't
win any awards. Thanks Cody.

On May 15, 2:08 pm, "Cody Fauser" <codyfau...@gmail.com> wrote:
> I think the issue may be that the PayPal sandbox is incredibly flaky
> right now. On average transactions have been taking 40+ seconds for me
> lately. I've also noticed a lot of people complaining the PayPal
> forums.
>
>
>
> On Thu, May 15, 2008 at 2:22 PM, voodoorails <paul.vudma...@gmail.com> wrote:
>
> > After further review ... ;)
>
> > The endpoint is correct ...
>
> >https://www.paypal.com/IntegrationCenter/ic_api-reference.html
> > -------
> > API Endpoints
> > The API Endpoints for your API calls depend on which authentication
> > mechanism you use and which calling mechanism you use. The table below
> > summarizes all of the endpoints.
> > Environment Authentication Calling Endpoint
> > -------
>
> > Sandbox API Certificate SOAPhttps://api.sandbox.paypal.com/2.0/
> > Sandbox API Signature SOAPhttps://api-3t.sandbox.paypal.com/2.0/
>
> > 1) some of the transactions made it to Paypal - I can see them in the
> > Seller transactions, just did not make it back - or my server timed
> > out before it could?
>
> > 2) I tried using the certificate - rather than the sig. And installed
> > it as a PEM file, as described here.
> >http://www.smallroomsoftware.com/articles/2006/12/5/paypal-website-pa...
>
> --
> Cody Fauserhttp://shopify.com- e-commerce done righthttp://www.codyfauser.com- bloghttp://peepcode.com/products/activemerchant-pdf- ActiveMerchant PeepCodehttp://www.oreilly.com/catalog/rjsrails- RJS Templates for Rails

voodoorails

unread,
May 16, 2008, 3:23:10 PM5/16/08
to Active Merchant
Just got off the phone w/tech support person, who was darn near
helpful :) "It's a timeout issue - it'll be fixed within 6 months",
lol.

I can understand that happening now and then but I've yet to get ONE
transaction to work. So I've got to up my timeout time for the
request. Is that an option in AM per request or should I do that ...
somewhere else?

voodoorails

unread,
May 16, 2008, 3:37:21 PM5/16/08
to Active Merchant
# posts_data.rb
module ActiveMerchant #:nodoc:
class ConnectionError < ActiveMerchantError
end

class RetriableConnectionError < ConnectionError
end

module PostsData #:nodoc:
MAX_RETRIES = 3
OPEN_TIMEOUT = 60
READ_TIMEOUT = 120 #changed from 60.

Will see if that helps :)
> > > Cody Fauserhttp://shopify.com-e-commercedone righthttp://www.codyfauser.com-bloghttp://peepcode.com/products/activemerc...PeepCodehttp://www.oreilly.com/catalog/rjsrails-RJSTemplates for Rails

voodoorails

unread,
May 16, 2008, 3:51:22 PM5/16/08
to Active Merchant
Hmmm, that took a little longer - but still timed out. If I run it
again ... "The transaction could not be loaded"

Maybe I have to redo my sandbox account as someone on here suggested?
I've redone my credentials.

This is definitely not an AM thing.
> > > > Cody Fauserhttp://shopify.com-e-commercedonerighthttp://www.codyfauser.com-bloghttp://peepcode.com/products/activemerc...for Rails

Cody Fauser

unread,
May 16, 2008, 3:59:55 PM5/16/08
to activem...@googlegroups.com
I had success by running only a single transaction at a time. They
each take 40 - 50 seconds, but eventually are successful and timeout
less frequently than trying to run the entire suite at once.

--

voodoorails

unread,
May 16, 2008, 4:44:16 PM5/16/08
to Active Merchant
I'm only trying to authorize one transaction :(

I've been off and on with Tech support over there - highly recommend
avoiding that!

I'm on my localhost - behind a router (linksys/residential) you think
that would matter ?- the same thing happened when I moved it to my
prod server so I doubt it. I'm running on port 3000. Thanks Cody.
> >> > > > Cody Fauserhttp://shopify.com-e-commercedonerighthttp://www.codyfauser.com-blogh...Rails

Cody Fauser

unread,
May 16, 2008, 7:01:24 PM5/16/08
to activem...@googlegroups.com
The connection is outbound, so that shouldn't be the problem. I would probably attribute it to their servers. Try the remote PayPal Express tests. They just fetch a token and will give you an indication if you can connect at all to their servers.

voodoorails

unread,
May 17, 2008, 1:26:46 PM5/17/08
to Active Merchant
Didn't think so ... dang

Apologies for taking up your time on this trivial stuff I should prob
know :(

I've had some success - after deleting and re-adding my test accounts
- for buyer and seller. There are at least :) 2 reasons why the
transactions might have been hanging 1) I was using a test card that
passes rudimentary validation - but not one from my sandbox. 2) My
buyer account might not have been properly setup for website payments
pro.

When I did that, I got a successful Ack -
...<DoDirectPaymentResponse xmlns="urn:ebay:api:PayPalAPI"><Timestamp
xmlns="urn:ebay:apis:eBLBaseComponents">2008-05-17T15:26:48Z</
Timestamp>

<Ack xmlns="urn:ebay:apis:eBLBaseComponents">Success</Ack>

<CorrelationID
xmlns="urn:ebay:apis:eBLBaseComponents">93de7a7f195c</
CorrelationID><Version
xmlns="urn:ebay:apis:eBLBaseComponents">2.000000</Version><Build
xmlns="urn:ebay:apis:eBLBaseComponents">548868</Build><Amount
xsi:type="cc:BasicAmountType" currencyID="USD">9.89</
Amount><AVSCode xsi:type="xs:string">X</AVSCode><CVV2Code
xsi:type="xs:string">M</CVV2Code><TransactionID>2Y573531HB4950007</
TransactionID>
...

but interestingly AM did not recognize it as a successful response.

response = yield gateway

result.success = response.success?
result.reference = response.authorization
result.message = response.message
result.params = response.params
result.test = response.test?
#rescue ActiveMerchant::ActiveMerchantError => e
# result.success = false
# result.reference = nil
# result.message = e.message
# result.params = {}
# result.test = gateway.test?


(I'm following the AM Peepcode code) I thought for sure it was because
it did not like the response's xml format so I commented out the
rescue but still, response.success? returned false

I'm following your advice and checking out the unit test.
Embarrassingly this is new to me :) First I got an error because I
needed to install the Money gem - I assume that is included with the
plugin. Then I get a cert error - for both express and pro.

1) Error:
test_failed_authorization(PaypalTest):
OpenSSL::X509::CertificateError: not enough data

1) Error:
test_set_express_authorization(PaypalExpressTest):
OpenSSL::X509::CertificateError: not enough data

Is that because I used the sig and not the cert this go time? Can I
use the same authorization for both Express and Website Payments Pro?

Cody Fauser

unread,
May 17, 2008, 1:39:42 PM5/17/08
to activem...@googlegroups.com
Try the following:

sudo gem install money
sudo gem install mocha
sudo gem install rails

If you're using the API signature then open up test/fixtures.yml and edit the paypal_signature entry to use your credentials. Then change the remote test test/remote/gateways/remote_paypal_test.rb to use the signature by changing fixtures(:paypal_certificate) to fixtures(:paypal_signature) at the top.

You should now be able to the run the tests.

Grzegorz Furmanek

unread,
May 17, 2008, 1:59:11 PM5/17/08
to activem...@googlegroups.com
Hi Voodoorails,

I have been following your discussion and I have to agree with Cody.
Paypal sandbox is a very poor excuse for a testing environment. Their
Website Pro
gateway elicited a steady stream of colorful expletives when I was
developing against it.

It's quite amazing a company with such reach can be so careless
about their third
party developer base.

I have experienced the same issues and tried similar remedies.
Here are my observations:

1. Extending timeouts will usually give you a PayPal internal server errors:
- 10001 Internal Timeout
- Transaction could not be loaded
- Connection recent by a peer (with an internal ip address, a 10.*.*.*)

2. As Cody already mentioned you should not expect for the transactions
to complete
sooner then 40 or 50 seconds.

3. Some times are better then other but I have noticed that the times
the server may
be more responsive on one day aren't necessarily be the same for
other days.

Working on the PayPal NVP gateway I have noticed that it does not
change much
in that aspect either because the transactions are being processed by
some internal system
which appears to be the sole cause of these problems.

Honestly, if you want to stay with PayPal (the company) I would
recommend their
PayFlow gateway. It is a much more responsive. I don't know about the
cost differences
between those two but it may be worth considering the aggravation you
have to experience
when developing against PayPal Website Pro solution.

Sincerely

- Greg Furmanek
Site: http://furmanek.net

voodoorails

unread,
May 17, 2008, 2:43:34 PM5/17/08
to Active Merchant
This is clearly a Paypal/stupid dev prob - thanks for your patience.

On May 17, 12:39 pm, "Cody Fauser" <codyfau...@gmail.com> wrote:
> Try the following:
> sudo gem install money
> sudo gem install mocha
> sudo gem install rails


/www/scents> gem list
*** LOCAL GEMS ***
mocha (0.5.6, 0.5.5)
money (1.7.1)
rails (2.0.2, 1.2.2)

> If you're using the API signature then open up test/fixtures.yml and edit
> the paypal_signature entry to use your credentials. Then change the remote
> test test/remote/gateways/remote_paypal_test.rb to use the signature by
> changing fixtures(:paypal_certificate) to fixtures(:paypal_signature) at the
> top.

paypal_signature:
login: paul_b...@domain.com
password: 121....851
signature: AMCrVazGwUVXlz9Lb......rM1pSSl6i

> You should now be able to the run the remote_paypal_test.rb

Changed a couple things in the test - with a sandboxed card, "Test
User" is the cardholder name in sandbox etc.

@creditcard = CreditCard.new(
:type => "Visa",
:number => "4083089508820805", # Use a generated CC
from the paypal Sandbox, CHECK
:verification_value => "000",
:month => 1,
:year => 2009,
:first_name => 'Test',
:last_name => 'User'
)

@params = {
:order_id => generate_unique_id,
:email => 'bu...@jadedpallet.com',
:billing_address => { :name => 'Test User',
:address1 => '1234 Penny Lane',
:city => 'Jonsetown',
:state => 'NC',
:country => 'US',
:zip => '23456'
} ,
:description => 'Stuff that you purchased, yo!',
:ip => '10.0.0.1'
}

They run ;0) All of them seem to fail here.

/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'

1) Failure:
test_failed_multiple_transfer(PaypalTest)
[remote_paypal_test.rb:160:in `test_failed_multiple_transfer'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run']:
Response failed: #<ActiveMerchant::Billing::Response:0x12e6d54
@message=nil, @test=true, @authorization=nil, @success=false,
@cvv_result={"message"=>nil, "code"=>nil}, @params={},
@fraud_review=nil, @avs_result={"message"=>nil, "code"=>nil,
"street_match"=>nil, "postal_match"=>nil}>.
<false> is not true.

2) Failure:
test_purchase_and_full_credit(PaypalTest)
[remote_paypal_test.rb:116:in `test_purchase_and_full_credit'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run']:
Response failed: #<ActiveMerchant::Billing::Response:0x1a4c3dc
@message=nil, @test=true, @authorization=nil, @success=false,
@cvv_result={"message"=>nil, "code"=>nil}, @params={},
@fraud_review=nil, @avs_result={"message"=>nil, "code"=>nil,
"street_match"=>nil, "postal_match"=>nil}>.
<false> is not true.

3) Failure:
test_successful_authorization(PaypalTest)
[remote_paypal_test.rb:64:in `test_successful_authorization'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run']:
Response failed: #<ActiveMerchant::Billing::Response:0x1a1e1e4
@message=nil, @test=true, @authorization=nil, @success=false,
@cvv_result={"message"=>nil, "code"=>nil}, @params={},
@fraud_review=nil, @avs_result={"message"=>nil, "code"=>nil,
"street_match"=>nil, "postal_match"=>nil}>.
<false> is not true.

4) Failure:
test_successful_capture(PaypalTest)
[remote_paypal_test.rb:99:in `test_successful_capture'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run']:
Response failed: #<ActiveMerchant::Billing::Response:0x19f05b4
@message=nil, @test=true, @authorization=nil, @success=false,
@cvv_result={"message"=>nil, "code"=>nil}, @params={},
@fraud_review=nil, @avs_result={"message"=>nil, "code"=>nil,
"street_match"=>nil, "postal_match"=>nil}>.
<false> is not true.

5) Failure:
test_successful_multiple_transfer(PaypalTest)
[remote_paypal_test.rb:150:in `test_successful_multiple_transfer'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run']:
Response failed: #<ActiveMerchant::Billing::Response:0x19bdbf0
@message=nil, @test=true, @authorization=nil, @success=false,
@cvv_result={"message"=>nil, "code"=>nil}, @params={},
@fraud_review=nil, @avs_result={"message"=>nil, "code"=>nil,
"street_match"=>nil, "postal_match"=>nil}>.
<false> is not true.

6) Failure:
test_successful_purchase(PaypalTest)
[remote_paypal_test.rb:44:in `test_successful_purchase'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run']:
Response failed: #<ActiveMerchant::Billing::Response:0x19a21c0
@message=nil, @test=true, @authorization=nil, @success=false,
@cvv_result={"message"=>nil, "code"=>nil}, @params={},
@fraud_review=nil, @avs_result={"message"=>nil, "code"=>nil,
"street_match"=>nil, "postal_match"=>nil}>.
<false> is not true.

7) Failure:
test_successful_purchase_with_api_signature(PaypalTest)
[remote_paypal_test.rb:51:in
`test_successful_purchase_with_api_signature'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run']:
Response failed: #<ActiveMerchant::Billing::Response:0x196bfd0
@message=nil, @test=true, @authorization=nil, @success=false,
@cvv_result={"message"=>nil, "code"=>nil}, @params={},
@fraud_review=nil, @avs_result={"message"=>nil, "code"=>nil,
"street_match"=>nil, "postal_match"=>nil}>.
<false> is not true.

8) Failure:
test_successful_transfer(PaypalTest)
[remote_paypal_test.rb:136:in `test_successful_transfer'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run']:
Response failed: #<ActiveMerchant::Billing::Response:0x193bb50
@message=nil, @test=true, @authorization=nil, @success=false,
@cvv_result={"message"=>nil, "code"=>nil}, @params={},
@fraud_review=nil, @avs_result={"message"=>nil, "code"=>nil,
"street_match"=>nil, "postal_match"=>nil}>.
<false> is not true.

9) Failure:
test_successful_voiding(PaypalTest)
[remote_paypal_test.rb:109:in `test_successful_voiding'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `__send__'
/opt/local/lib/ruby/gems/1.8/gems/mocha-0.5.6/lib/mocha/
test_case_adapter.rb:19:in `run']:
Response failed: #<ActiveMerchant::Billing::Response:0x19263b8
@message=nil, @test=true, @authorization=nil, @success=false,
@cvv_result={"message"=>nil, "code"=>nil}, @params={},
@fraud_review=nil, @avs_result={"message"=>nil, "code"=>nil,
"street_match"=>nil, "postal_match"=>nil}>.
<false> is not true.

voodoorails

unread,
May 17, 2008, 2:59:03 PM5/17/08
to Active Merchant
Thanks for you insightful response, Greg.

Myself, and the owner of the site are going to give Payflow, or some
other alternative(prob sticking with authorize.net), serious
consideration :)

Thus far she has been insistent on keeping Paypal Express - which made
a PP gateway ... appealing ... at first at least. Thanks again.

voodoorails

unread,
May 18, 2008, 12:15:47 PM5/18/08
to Active Merchant
<hangs head in shame> I'm an embarrassment to the ruby/rail/human
community.

#print(uri,uri.request_uri, data, headers)
http.post(uri.request_uri, data, headers).body

So I could see what was being returned I had
....
print http.post(uri.request_uri, data, headers).body

Of course that did not return the response properly from the method.

Express test runs properly.

Pro returns 3 failures but I think I know why.

Big thanks for AM and your patience.

Cody Fauser

unread,
May 18, 2008, 2:25:05 PM5/18/08
to activem...@googlegroups.com
I'm glad you got it figured out :) A good way to debug net/http calls is to use:

http.set_debug_output(STDOUT)
Reply all
Reply to author
Forward
0 new messages