Giter Club home page Giter Club logo

Comments (13)

jpablobr avatar jpablobr commented on September 24, 2024

I believe this should do it. Can you try now?

ebfdd6f

from active_paypal_adaptive_payment.

vinceh avatar vinceh commented on September 24, 2024

I uninstalled the gem and did another bundle install and I'm still getting the same error. Or do you want me to download the latest version of the code from GitHub?

from active_paypal_adaptive_payment.

jpablobr avatar jpablobr commented on September 24, 2024

can you try with gem "active_paypal_adaptive_payment", "~> 0.3.9" in your Gemfile

from active_paypal_adaptive_payment.

vinceh avatar vinceh commented on September 24, 2024

Great. Seems to start now.

Now when I try to make the payment, I get this from PayPal's website:

URL: https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=
Message: This transaction is invalid. Please return to the recipient's website and try again.

Code inside my controller:

gateway =  ActiveMerchant::Billing::PaypalAdaptivePayment.new(
            :login => "npo_1332820242_biz_api1.gmail.com",
            :password => "XXXXXXX", 
            :signature => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            :appid => "APP-80W284485P519543T" )

        recipients = [{:email => '[email protected]',
                 :amount => 5,
                 :primary => true},
                {:email => '[email protected]',
                 :amount => 10,
                 :primary => false}
                 ]

        response = gateway.setup_purchase(
            :return_url => url_for(:action => :complete, :only_path => false),
            :cancel_url => url_for(:action => :cancel, :only_path => false),
            :ipn_notification_url => url_for(:action => :success, :only_path => false),
            :receiver_list => recipients
        )

        redirect_to (gateway.redirect_url_for(response["payKey"]))

Anything you spot right away?

from active_paypal_adaptive_payment.

jpablobr avatar jpablobr commented on September 24, 2024

did you set the test mode in your app?

#config/environments/{environment.rb}
App::Application.configure do
  config.setting...
end
ActiveMerchant::Billing::Base.mode = :test

from active_paypal_adaptive_payment.

vinceh avatar vinceh commented on September 24, 2024

Yup, in both development.rb and production.rb

I should also probably mention that I'm testing it through Heroku since I can't do it locally, and that's where I'm getting the issue from, but I'm not sure if that has to do with anything.

from active_paypal_adaptive_payment.

jpablobr avatar jpablobr commented on September 24, 2024

I never had any issues like that with heroku.

Are you using Spree? in that case, the config settings Payment Methods (in admin), the environment should reflect the PayPal environment. For example, in production the server should not be configure to test.

from active_paypal_adaptive_payment.

vinceh avatar vinceh commented on September 24, 2024

No, I'm not using Spree.

I created a simple application that tests out the functionality of the gem.

The repository is here (I took out the PayPal credentials to the latest commit): https://github.com/vinceh/testpaypal

And I've hosted on Heroku @ http://blazing-meadow-5453.herokuapp.com/

Do you want to take a look? The :test is in the environments, and it's just copy and pasted code into the controller. Maybe you can spot something.

from active_paypal_adaptive_payment.

jpablobr avatar jpablobr commented on September 24, 2024

Have you ran the tests? do they run fine? you only have to update this file with your credentials

https://github.com/jpablobr/active_paypal_adaptive_payment/blob/master/test/fixtures.example.yml (remove the example part)

from active_paypal_adaptive_payment.

vinceh avatar vinceh commented on September 24, 2024

No I have not. I will try it tomorrow. But I noticed there is a pay_key attribute. What is that? I never specified anything like that in my application; is that the problem?

from active_paypal_adaptive_payment.

jpablobr avatar jpablobr commented on September 24, 2024

See issue #14

#14

That might help you a bit. And yes, you need the pay_key, that's Paypal's first response to your payment request.

from active_paypal_adaptive_payment.

vinceh avatar vinceh commented on September 24, 2024

I wrapped the redirect_to with

if response.success?
    redirect_to (gateway.redirect_url_for(response[:pay_key]))
end

And it seems that my response is not successful. How do I debug this?

from active_paypal_adaptive_payment.

jpablobr avatar jpablobr commented on September 24, 2024

response.inspect should contain PayPal's response... see what you got there and search for that specific error on PayPals documentation.

from active_paypal_adaptive_payment.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.