question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RNIap.prepare : canMakePayments is not a function

See original GitHub issue

Version of react-native-iap : 1.3.6

Platforms you faced the error (IOS or Android or both?) : iOS 11.4.1

Expected behavior : no error expected

Actual behavior

RNIap.prepare sometimes throws an error : RNIap.prepare error : TypeError: a.canMakePayments is not a function. (In ‘a.canMakePayments()’, ‘a.canMakePayments’ is undefined)

Tested environment : real device iPhone6s

Steps to reproduce the behavior

try {
    await RNIap.prepare();
}
catch (error) {
    console.log("RNIap.prepare error : ", error);
}

Link Library seems to be set accordindly to documentation : capture d ecran 2018-08-14 a 00 59 00

As it is something I track in Sentry, I don’t have the full context of use on client side, it is possible it happens when the user hit the cancel button when asked for his AppStore credentials or when you are in a Sandbox mode .I need to dig more into this, to give more context and reproducible behavior.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
hyochancommented, Sep 16, 2018

Closing this since it seems linking issue in react-native.

1reaction
lc3t35commented, Aug 15, 2018

@dooboolab ok I should have stated that the module was already published with the correct current version that has canMakePayments method. Even the previous build already had the last version of react-native-iap. Of course if there is an update in react-native modules such as react-native-iap, you have to resubmit a build of the app. The current build of the app has the current version of react-native-iap. The iOS app used for the test is this latest build (all this is tracked on Sentry so I’m 100% sure).

Read more comments on GitHub >

github_iconTop Results From Across the Web

RNIap.prepare : canMakePayments is not a function | Gitcoin
Version of react-native-iap : 1.3.6 ### Platforms you faced the error (IOS or Android or both?) : iOS 11.4.1 ### Expected behavior :...
Read more >
React Native Android In App Purchase Error - Stack Overflow
On android Only - you need to open a connection to the billing service. This used to be RNIAP.prepare() , but it is...
Read more >
react-native-iap - npm
In ios, it will simply call canMakePayments method and return value. ... Next, call the prepare function (ios it's not needed, ...
Read more >
canMakePayments vs. ApplePaySession - Apple Developer
Hello, guys! As far as I understood, there is no difference between ApplePaySession.canMakePayments and window.ApplePaySession checking, right?
Read more >
How to use the react-native-iap.buySubscription function in ...
export async function showPayment(planId, callback) { try { await RNIap.prepare(); await RNIap.getSubscriptions([planId]); const purchase = await RNIap.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found