如何避免使用带有红宝石PayPal的支付自适应身份验证API和时间的问题? [英] How can I avoid auth and time issues using Paypal's Adaptive Payments API with Ruby?

查看:256
本文介绍了如何避免使用带有红宝石PayPal的支付自适应身份验证API和时间的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行到试图从红宝石访问PayPal的自适应支付API多个问题。

I'm running into multiple issues trying to access Paypal's Adaptive Payment API from Ruby.

我跑进最初的主要问题是,贝宝需要自己的HTTP标头全部大写,但网:: HTTP并不preserve HTTP标头的情况下(它存储他们'downcased',然后输出它们资本 - 如果你设置页眉X-PAYPAL-SECURITY-USERID它存储为X-贝宝安全用户标识并输出为X-贝宝安全性用户标识')

The main issue I ran into initially was that Paypal requires their HTTP headers to be in all caps but Net::HTTP does not preserve the case of HTTP headers (it stores them 'downcased' and then outputs them 'capitalized' -- so if you set the header 'X-PAYPAL-SECURITY-USERID' it is stored as 'x-paypal-security-userid' and output as 'X-Paypal-Security-Userid').

当我试图通过API使用这些错误套管头我得到50万内部服务器的错误。

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

所以我monkeypatched的Net :: HTTP到preserve头的情况。但现在我得到超时异常:

So I monkeypatched Net::HTTP to preserve the case of the headers. But now I am getting 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'

所以,回到我原来的问题:有没有人成功地访问使用Ruby自适应支付API?如果是这样,有什么秘诀吗?

So, back to my original question: Is anyone successfully accessing the adaptive payments API using Ruby? If so, what's your secret?

推荐答案

我创建了一个红宝石贝宝支付自适应宝石。我成功地用它在nextsprocket.com

I created a paypal adaptive payments gem for ruby. I'm using it successfully at nextsprocket.com

下面是关于它的博客文章:<一href=\"http://tommy.chheng.com/index.php/2009/12/paypal-adaptive-ruby-gem-released/\">http://tommy.chheng.com/index.php/2009/12/paypal-adaptive-ruby-gem-released/

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

给它一个镜头,看看它是否会帮助你。

Give it a shot and see if it will help you.

这篇关于如何避免使用带有红宝石PayPal的支付自适应身份验证API和时间的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆