Rails PayPal自适应

我正在使用paypal_adaptive gem并遇到一些问题。 这是我在config / paypal_adaptive.yml中的代码:

development: environment: "sandbox" username: "x@gmail.com" password: "xxx" signature: "xxx" application_id: "APP-80W284485P519543T" test: environment: "sandbox" username: "x@gmail.com" password: "xxx" signature: "xxx" application_id: "APP-80W284485P519543T" enviorment: environment: "sandbox" username: "x@gmail.com" password: "xxx" signature: "xxxx" application_id: "APP-80W284485P519543T" 

当然,XXX是真实的细节。 我也尝试过给我的API凭据,但无论如何都没有用。 这是控制付款的控制器代码:

> pay_request = PaypalAdaptive :: Request.new

 data = { "returnUrl" => "http://localhost:3000/payments/completed_payment_request", "requestEnvelope" => {"errorLanguage" => "en_US"}, "currencyCode"=>"USD", "receiverList"=>{"receiver"=>[{"email"=>"xxx@gmail.com", "amount"=>"10.00"}]}, "cancelUrl"=>"http://localhost:3000/payments/canceled_payment_request", "actionType"=>"PAY", "ipnNotificationUrl"=>"http://localhost:3000/payments/ipn_notification" } @pay_response = pay_request.pay(data) 

尝试输出pay_response时,我得到以下数组(包含错误):

> [“responseEnvelope”,{“timestamp”=>“2011-05-03T12:00:54.107-07:00”,“ack”=>“失败”,“correlationId”=>“242e1fc31cf18”,“build”= >“1846084”}] [“error”,[{“errorId”=>“560022”,“domain”=>“PLATFORM”,“subdomain”=>“应用程序”,“严重性”=>“错误”,“ category“=>”Application“,”message“=>”X-PAYPAL-APPLICATION-ID标头包含无效值“,”参数“=> [”X-PAYPAL-APPLICATION-ID“]}]]

我真的很无望。 提前致谢。

更改密钥后,请确保重新启动rails服务器

答案是,您的posturl,检查您发布到沙盒或实时https://svcs.sandbox.paypal.com/AdaptivePayments/Pay如果您使用沙盒ID确保您使用沙盒url..

这与您的YAML格式相同还是正确缩进? 尝试重新格式化您的YAML。 由于YAML格式错误,我过去也遇到过类似的问题。

实际上我从来没有让它工作,我自己做的付款。 然后我想在编辑YAML后我没有重置我的服务器! :d

不管怎么说,多谢拉!