Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

payKey issue #42

Open
ghost opened this issue Mar 22, 2013 · 5 comments
Open

payKey issue #42

ghost opened this issue Mar 22, 2013 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 22, 2013

I'm trying to setup a payment using the following codes:

response = @gateway.setup_purchase(
          :return_url => url_for(:action => :done, :params => {:order => @order.number}),
          :cancel_url => url_for(:action => :cancel, :params => {:order => @order.number}),
          :ipn_notification_url => url_for(:action => :ipn, :params => {:order => @order.number}),
          :receiver_list => recipients
      )

then, i redirect user to paypal site using the following logic

if response[:payKey].present?
        redirect_to @gateway.redirect_url_for(response[:payKey])
else
        #something else to happen
end

I've seen response[:payKey] is nil sometime. That's why it is not redirecting to Paypal. Why response[:payKey] is missing and what should I do actually do to resolve this?

FYI: I'm trying to setup a Chained payments with primary recipient.

Thanks in advance.

@cheeyeo
Copy link

cheeyeo commented Mar 26, 2013

the response body seems to have changed?

i get it to work by calling response.pay_key

@cheeyeo
Copy link

cheeyeo commented Mar 26, 2013

try doing a print of the response body and you should see it in there for debugging

@digitalWestie
Copy link

What does response.request return?

Also have a look at response.request and response.request.message

@ghost
Copy link
Author

ghost commented May 10, 2013

response.request has this:

{"PayRequest"=>{"requestEnvelope"=>{"detailLevel"=>"ReturnAll", "errorLanguage"=>"en_US"}, "actionType"=>"PAY", "cancelUrl"=>"http://REMOVED.com/cancel?order=6426480503", "returnUrl"=>"http://REMOVED.com/done?order=6426480503", "ipnNotificationUrl"=>"http://REMOVED.com/ipn?order=6426480503", "currencyCode"=>"USD", "receiverList"=>{"receiver"=>[{"email"=>"[email protected]", "amount"=>"1.76", "primary"=>"true"}, {"email"=>"[email protected]", "amount"=>"0.21", "primary"=>"false"}, {"email"=>"[email protected]", "amount"=>"0.1", "primary"=>"false"}]}, "reverseAllParallelPaymentsOnError"=>"false"}}

response.request.message:
NoMethodError Exception: undefined method `message' for #Hash:0x007f9e7e5603c8

@digitalWestie
Copy link

I thought the error message was in response.request, you actually get an array of error messages from response.error

You can get the message by accessing

response.error[0].message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants