iaphub / react-native-iaphub

The easiest way to implement IAP (In-app purchase) in your React Native app.
https://www.iaphub.com/
MIT License
317 stars 21 forks source link

getProductsForSale does not return data and does not display an error (Android) #105

Closed ovchinnikovs closed 2 years ago

ovchinnikovs commented 2 years ago

I am trying to run Iaphub.getProductsForSale() on Android SDK 31 on a real device.

but the attempt fails.

I debugged the entire call chain and got to the RNIap.getSubscriptions() method, which breaks the call chain and returns nothing.

I investigated the call in this call to this method in the react-native-iap library and debugged the native RNIapModule.java module and found out that the method shown in the photo breaks the loop and breaks everything.

Screen Shot 2022-02-10 at 19 16 49

can you tell me what could be the problem? is it because react-native-iap is not installed correctly or because of json file configuration or testing environment is not correct?

P.S. IOS works is fine

iaphub commented 2 years ago

Hey @ovchinnikovs, are you using react-native-iap@5.2.6? https://github.com/iaphub/react-native-iaphub#getting-started

ovchinnikovs commented 2 years ago

Hey @iaphub yes, I using 5.2.6 version iap.

I install react-native-iap@8.0.4 latest version - android worked🙌 purchases come and even the subscription has passed but ios now have stopped working😥

Thereafter I do a downgrade to version 5.2.6 then the situation changes back ios worked but android does not work🤷

iaphub commented 2 years ago

Ok weird. I do not know why the zza method is failing on your app. We do not have this issue on our side and we never had this issue reported before. Also the packageNameAndroid property isn't even used by the IAPHUB library. We're going to release pretty soon a library update that doesn't use react-native-iap as a dependency (so it'll fix your issue), in the meantime I would recommend just commenting the line adding packageNameAndroid as a temporary fix (since it's not even used).

I'm closing the issue but you can since comment if you have any questions.

ovchinnikovs commented 2 years ago

@iaphub packageNameAndroid is used in the native module RNIapModule.java which uses the RNIap.getSubscriptions() method, you use this method for your productForSale()

iaphub commented 2 years ago

Yes @ovchinnikovs I'm aware of that. You can install the version of react-native-iap below, it is the version 5.2.6 without the packageNameAndroid that is causing you an issue (for an unknown reason). It is probably the easiest solution for you until we release the next version of react-native-iaphub that won't use react-native-iap as a dependency.

npm install git://github.com/iaphub/react-native-iap.git#fix/package-name