GithubHelp home page GithubHelp logo

Comments (21)

mnicpt avatar mnicpt commented on July 20, 2024 1

@JasonTheAdams I will take a look at it and get back to you. Thank you for sharing.

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024 1

To be clear, in our case we need to use both onClick and onError, so this is a blocker for us.

from paypal-sdk-client.

mnicpt avatar mnicpt commented on July 20, 2024 1

@JasonTheAdams It's more that it's not clear and can't commit to a date. We will certainly do our best.

from paypal-sdk-client.

issue-label-bot avatar issue-label-bot commented on July 20, 2024

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.69. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

from paypal-sdk-client.

mnicpt avatar mnicpt commented on July 20, 2024

@JasonTheAdams I'm seeing this message in the logs: Partner Policy config not found for request. Also, try to throw an error at the first line of the createOrderHandler and see if it catches it.

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024

@mnicpt We figured out the issue. It turns out that if the onClick option is used, then onError no longer works. You can see this in my codepen: https://codepen.io/JasonTheAdams/pen/gOrKyoG — if you comment out the onClick option then onError starts working.

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024

@mnicpt As an update, we are coordinating with our PayPal Sr. Integration Engineer to aim to launch in a couple of weeks. We have another bug on PayPal's side going live on the 30th. If it's at all possible to have a fix in place before then, that would be incredibly helpful. Having the ability to catch and present errors meaningfully to our users is important.

Thanks!

from paypal-sdk-client.

mnicpt avatar mnicpt commented on July 20, 2024

@JasonTheAdams Can you send me the code that is being executed in the onClickHandler?

from paypal-sdk-client.

mnicpt avatar mnicpt commented on July 20, 2024

@JasonTheAdams Also want to mention that the onError function will only be called for errors occurring inside our libraries and not from custom code. I ran the pen above and I don't see the onError function being called. An example of this error may come from the orderId not being passed to the onApprove call or the token is not being passed to createOrder. If you are expecting and error to be caught from your custom code, we don't support that through the onError function.

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024

Hi @mnicpt! That's the point of the pen above. 😉 If you comment out the onClick: function() { } line then you'll see that onError works as expected.

It does seem to me that whatever calls onError is simply catching JS Errors that get thrown — which is great!

Also, to answer your question, the error is being thrown in createOrder, just like in that pen. The issue isn't with what's in our onClick callback, as even an empty callback causes the issue.

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024

Just to help make it clear:
onClick issue

from paypal-sdk-client.

bluepnume avatar bluepnume commented on July 20, 2024

Yep there's definitely an inconsistency we need to fix here. We may need a few days to dig into this and figure out what the best fix is, and that we're consistently returning the right kind of errors (whether or not onClick is passed)

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024

Awesome, thank you! 🙌

from paypal-sdk-client.

mnicpt avatar mnicpt commented on July 20, 2024

Hi @mnicpt! That's the point of the pen above. 😉 If you comment out the onClick: function() { } line then you'll see that onError works as expected.

It does seem to me that whatever calls onError is simply catching JS Errors that get thrown — which is great!

Also, to answer your question, the error is being thrown in createOrder, just like in that pen. The issue isn't with what's in our onClick callback, as even an empty callback causes the issue.

My bad. My head was spinning yesterday looking at why this was occurring. As Daniel mentioned above, and after much exploration yesterday, we want to make sure that we do this right and will let you know when we have this ready for you. Thanks again, @JasonTheAdams .

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024

My bad. My head was spinning yesterday looking at why this was occurring. As Daniel mentioned above, and after much exploration yesterday, we want to make sure that we do this right and will let you know when we have this ready for you. Thanks again, @JasonTheAdams .

Not a problem at all. Thank you for your efforts. 😄

from paypal-sdk-client.

mnicpt avatar mnicpt commented on July 20, 2024

@JasonTheAdams I know you mentioned above about launching in a couple of weeks. The fix for this is not trivial and will most likely take longer than that alongside the other prioritized work. Would you be able, for the short-term, try-catch any errors for now and then can have a more reliable onError function once we get the fix released?

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024

@mnicpt I see, that's unfortunate. We're slated to launch the second week of October. You don't think it will be done by then? If not, we'll have to see what we can do to workaround it.

from paypal-sdk-client.

bluepnume avatar bluepnume commented on July 20, 2024

@JasonTheAdams if it's a matter of unblocking your launch, can you just do something like:

const errorHandler = (err) => {
    // ...
}

paypal.Buttons({
    createOrder: () => {
        return fetch().then(() => {
            // ...
        }).catch(errorHandler);
    },
    onError: errorHandler
})

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024

Thanks, @bluepnume, we'll give that a shot. It does, of course, mean that we'll miss any errors that happen outside of the createOrder function — say if there's an issue after the order is provided to the SDK.

from paypal-sdk-client.

mnicpt avatar mnicpt commented on July 20, 2024

@JasonTheAdams A fix for this has been released. Please check to see if that has fixed your issue. I will close for now but feel free to reopen if you are still seeing issues.

from paypal-sdk-client.

JasonTheAdams avatar JasonTheAdams commented on July 20, 2024

@mnicpt Awesome! I see that my codepen is working now. Thank you!

from paypal-sdk-client.

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.