Giter VIP home page Giter VIP logo

Comments (6)

juwlee avatar juwlee commented on July 17, 2024

@k9keeper this sounds like an API issue, but to make sure, could you try curl?

from paypal-java-sdk.

k9keeper avatar k9keeper commented on July 17, 2024

@juwlee It works with curl. State come back approved and payer is populated. How do I get around this issue?

from paypal-java-sdk.

juwlee avatar juwlee commented on July 17, 2024

@k9keeper can you please share your curl and java requests/responses?

from paypal-java-sdk.

k9keeper avatar k9keeper commented on July 17, 2024

@juwlee The curl responses are correct as I stated above

This is how I tried to get the state.

APIContext paymentContext = getPayPalContext();
Payment authPayment = new Payment();
authPayment.setId(invoice.getPayInfo());
PaymentExecution paymentExecute = new PaymentExecution();
paymentExecute.setPayerId(payerId);
authPayment.execute(paymentContext, paymentExecute);

String state = authPayment.getState();
logger.info("paypal payment approval state=" + state + " payment=" + invoice.getPayInfo());

I got around the issue by calling the the Rest service using RestEasy client and parse the data into my own objects using GSON. I now have the state and payer info as desired, I am just not using the API code to do it

from paypal-java-sdk.

jaypatel512 avatar jaypatel512 commented on July 17, 2024

I think I found the issue @k9keeper . The problem is in Payment.execute() method. As you can see, the method returns the response Payment object. It does not update the object from where the execute was being called.

So, now, if you see the sample code here. It needs to be something like this:

            PaymentExecution paymentExecution = new PaymentExecution();
            paymentExecution.setPayerId(req.getParameter("PayerID"));
            try {
                payment = payment.execute(apiContext, paymentExecution);
                req.setAttribute("response", payment);
            } catch (PayPalRESTException e) {
                req.setAttribute("error", e.getMessage());
            }

Note that payment.execute return object is used to override existing object. I will update the samples soon to reflect this change.

You can now use the APIs just fine :)

Re-open the issue if you are still running into this.

from paypal-java-sdk.

k9keeper avatar k9keeper commented on July 17, 2024

payment.execute should be static.

Thanks, it works and Payer is populated as well

from paypal-java-sdk.

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.