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

This transaction is invalid. Please return to the recipient's website and try again. #31

Closed
hyperrjas opened this issue Jul 20, 2012 · 5 comments

Comments

@hyperrjas
Copy link

setup_purchase method does works fine for me with my data api, but preapprove_payment method does not works.

This is my controller:

def pay
 gateway =  ActiveMerchant::Billing::PaypalAdaptivePayment.new(
  :login => "email",
  :password => "pass",
  :signature => "signature",
  :appid => "APP-80W284485P519543T" )
  response = gateway.preapprove_payment( 
  :return_url => user_orders_url(current_user),
  :cancel_url => user_orders_url(current_user),
  :sender_email =>"email",
  :start_date => Time.now,
  :end_date => Time.now,
  :currency_code =>"USD",
  :max_amount => "20",
  :maxNumberOfPayments => "2")
 puts response.preapproval_key
 puts gateway.debug
  # for redirecting the customer to the actual paypal site to finish the payment.
  redirect_to (gateway.redirect_url_for(response["preapproval_key"]))
end

I get in log:

PA-8K9332086D720151L
{:url=>#<URI::HTTPS:0xdf9bd18 URL:https://svcs.sandbox.paypal.com/AdaptivePayments/Preapproval>, :request=>"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<PreapprovalRequest>\n  <requestEnvelope>\n    <detailLevel>ReturnAll</detailLevel>\n    <errorLanguage>en_US</errorLanguage>\n    <senderEmail>email</senderEmail>\n  </requestEnvelope>\n  <endingDate>2012-07-20T19:09:20</endingDate>\n  <startingDate>2012-07-20T19:09:20</startingDate>\n  <maxTotalAmountOfAllPayments>20</maxTotalAmountOfAllPayments>\n  <maxNumberOfPayments>2</maxNumberOfPayments>\n  <currencyCode>USD</currencyCode>\n  <cancelUrl>http://localhost:3000/en/u/maserranocaceres/orders</cancelUrl>\n  <returnUrl>http://localhost:3000/en/u/maserranocaceres/orders</returnUrl>\n</PreapprovalRequest>\n", :response=>"{\"responseEnvelope\":{\"timestamp\":\"2012-07-20T10:09:22.459-07:00\",\"ack\":\"Success\",\"correlationId\":\"ada6a3e7da93d\",\"build\":\"DEV\"},\"preapprovalKey\":\"PA-8K9332086D720151L\"}"}

What am I doing wrong?

@jpablobr
Copy link
Owner

Hey, is this the problem you are having?

#32

@hyperrjas
Copy link
Author

I have commented this inquiry in #32 but with :notify_url does not work for me.

Can you provide a guideline with a correct request for preapproved payment in readme?.

Thank you very much!

@hyperrjas
Copy link
Author

The problem is the method redirect_url_for for preapproved payment. The method correct is redirect_pre_approval_url_for in https://github.com/jpablobr/active_paypal_adaptive_payment/blob/master/lib/active_merchant/billing/gateways/paypal_adaptive_payment_common.rb#L26. Please can add these methods to the documentation? thanks!

@jpablobr
Copy link
Owner

@hyperrjas
Copy link
Author

Thank you Pablo! Regards!

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