Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

canMakePayment is not return promise as its throwing undefined when used with .then #175

Open
m-nathani opened this issue Oct 15, 2021 · 1 comment

Comments

@m-nathani
Copy link

m-nathani commented Oct 15, 2021

Bug report

Describe the bug

i am using the below stripe version and integrated payment request button, however got a error canMakePayment returun null or false .. as the promise is showing as undefined.

    "@stripe/react-stripe-js": "^1.6.0",
    "@stripe/stripe-js": "^1.19.1",
TypeError: o.canMakePayment().then((function(t){t&&e&&l(!0)})).finally is not a function. (In 
'o.canMakePayment().then((function(t){t&&e&&l(!0)})).finally((function(){p(!1)}))', 'o.canMakePayment().then(
(function(t){t&&e&&l(!0)})).finally' is undefin...

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

It should return promise in every case to make the return consistent, and if its not supported then it should throw an error that could be catched in promise

System information

  • browser: Mobile Safari 10.0
  • browser.name: Mobile Safari
  • device.family: iPad
  • os: iOS 10.3.3
  • Server environment: Node

Additional context

this is the code i am using to check the canMakePayment on the payementRequest

    if (paymentRequest) {
      paymentRequest
        .canMakePayment()
        .then((res) => {
          if (res && subscribed) {
            setCanMakePayment(true);
          }
        })
        .finally(() => {
          setPaymentLoading(false);
        });
    }

Got this exception on my client using sentry..

TypeError: o.canMakePayment().then((function(t){t&&e&&l(!0)})).finally is not a function. (In 
'o.canMakePayment().then((function(t){t&&e&&l(!0)})).finally((function(){p(!1)}))', 'o.canMakePayment().then((
function(t) {t&&e&&l(!0)})).finally' is undefined.
@m-nathani
Copy link
Author

m-nathani commented Oct 15, 2021

one of the solution could be to use this if condition too:

    if (paymentRequest?.canMakePayment) {
      paymentRequest
        .canMakePayment()
       .... 
      }

However, still the return should be consistent.

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

No branches or pull requests

1 participant