开发者

Rails PayPal adaptive

开发者 https://www.devze.com 2023-03-02 06:08 出处:网络
I am using paypal_adaptive gem and having some problems. This is my code in config/paypal_adaptive.yml:

I am using paypal_adaptive gem and having some problems. This is my code in 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. I also tried with the API credentials that were given me, didn't work either way. Here's the controller code which controls the payment:

> 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 foll开发者_StackOverflow社区owing array (which contains the error) when trying to 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"]}]]

I am really hopeless. Thanks in advance.


Make sure you restart the rails server after changing the key


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? Try reformatting your YAML. I've had similar problems in the past due to malformed 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

Thanks anyways!

0

精彩评论

暂无评论...
验证码 换一张
取 消