How to avoid authorization errors and time using Paypal Adaptive Payments API with Ruby?

I am running several issues trying to access the Ruby Paypal Adaptive Payments API.

The main problem I ran into was that Paypal requires their HTTP headers to be in all caches, but Net :: HTTP does not save the case of HTTP headers (it stores them “downcased” and then displays them “uppercase” - - therefore, if you set the header to "X-PAYPAL-SECURITY-USERID", it will be saved as "x-paypal-security-userid" and will be displayed as "X-Paypal-Security-Userid").

I was getting "500000 Internal Server" errors when I tried to use the API with these error headers.

So, I decapitated Net :: HTTP to keep the header case insensitive. But now I get timeout exceptions:

Timeout::Error (execution expired):
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:60:in `rbuf_fill'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:104:in `read_all'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:2220:in `read_body_0'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:2173:in `read_body'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:2198:in `body'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:2137:in `reading_body'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:1052:in `request'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:543:in `start'

So, back to my original question: is access to the adaptive payments API using Ruby successful? If so, what is the secret?

+3
source share
4 answers

I created a credit winnings for rubies. I use it successfully on nextsprocket.com

Here's a blog post about it: http://tommy.chheng.com/index.php/2009/12/paypal-adaptive-ruby-gem-released/

Take a picture and see if it helps you.

+6
source

PayPal Ruby SDK. Ruby Paypal . , , . , . .

Ruby SDK: https://www.x.com/community/ppx/sdks#ADAPI

:

1) xxx_controller.rb :

@paykey = @response [ "payKey" ]

@paykey = @response [ "payKey" ] [0]

2) form_tag (.) <% = form_tag (setpayparallel_path,....

<% = form_tag (setpayparallel_path,....

3) , <% end% >

, SDK

+2

I recommend https://github.com/jpablobr/active_paypal_adaptive_payment - I tried unsuccessfully to use the adaptive paypal gem, while APAP did a great job. (Finally.)

0
source

Offical Ruby PayPal Adaptive Payments SDK gem https://github.com/paypal/adaptivepayments-sdk-ruby

0
source

Source: https://habr.com/ru/post/1742897/


All Articles