简体   繁体   English

Rails PayPal 自适应

[英]Rails PayPal adaptive

I am using paypal_adaptive gem and having some problems.我正在使用paypal_adaptive gem 并且遇到了一些问题。 This is my code in config/paypal_adaptive.yml:这是我在 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"

of course the XXX is the real details.当然XXX是真实的细节。 I also tried with the API credentials that were given me, didn't work either way.我还尝试使用给我的 API 凭据,但无论哪种方式都不起作用。 Here's the controller code which controls the payment:这是控制付款的 controller 代码:

> pay_request = PaypalAdaptive::Request.new > 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)

I am getting the following array (which contains the error) when trying to output pay_response:尝试 output pay_response 时,我收到以下数组(包含错误):

> ["responseEnvelope", {"timestamp"=>"2011-05-03T12:00:54.107-07:00", "ack"=>"Failure", "correlationId"=>"242e1fc31cf18", "build"=>"1846084"}] ["error", [{"errorId"=>"560022", "domain"=>"PLATFORM", "subdomain"=>"Application", "severity"=>"Error", "category"=>"Application", "message"=>"The X-PAYPAL-APPLICATION-ID header contains an invalid value", "parameter"=>["X-PAYPAL-APPLICATION-ID"]}]] > ["responseEnvelope", {"timestamp"=>"2011-05-03T12:00:54.107-07:00", "ack"=>"Failure", "correlationId"=>"242e1fc31cf18", "build"= >"1846084"}] ["error", [{"errorId"=>"560022", "domain"=>"PLATFORM", "subdomain"=>"Application", "severity"=>"Error", " category"=>"Application", "message"=>"X-PAYPAL-APPLICATION-ID header 包含无效值", "parameter"=>["X-PAYPAL-APPLICATION-ID"]}]]

I am really hopeless.我真的绝望了。 Thanks in advance.提前致谢。

Make sure you restart the rails server after changing the key确保在更改密钥后重新启动 Rails 服务器

The Answer is, Your post url, check that your posting to the Sandbox or live https://svcs.sandbox.paypal.com/AdaptivePayments/Pay if your using a Sandbox ID make sure your using a Sandbox url.. The Answer is, Your post url, check that your posting to the Sandbox or live https://svcs.sandbox.paypal.com/AdaptivePayments/Pay if your using a Sandbox ID make sure your using a Sandbox url..

Is that the same format as your YAML or is it properly indented?这与您的 YAML 格式相同还是缩进正确? Try reformatting your YAML.尝试重新格式化您的 YAML。 I've had similar problems in the past due to malformed YAML.由于 YAML 格式错误,我过去也遇到过类似的问题。

Actually I never got it to work, I was doing the payment stuff by myself.实际上我从来没有让它工作,我自己做付款的事情。 Then I figured I didn't reset my server after editing the YAML: :D然后我想在编辑 YAML 后我没有重置我的服务器::D

Thanks anyways!不管怎么说,多谢拉!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM