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 wont return anything #104

Closed skayka closed 2 years ago

skayka commented 2 years ago

Hello good sirs.

I am trying to get products for sale on Android. Here's the code:

await Iaphub.init({
appId: '61e5ea5c3af34e1214bbb407',
apiKey: 'VIji2hHQiDqgeVYsqdQCUUwidk5jgA2h',
environment: 'production',
});

await Iaphub.setUserId(user.uid);

try {
var products = await Iaphub.getProductsForSale();
 console.log('\x1b[36m%s\x1b[0m', products);
} catch (e) {
console.error(e);
}

I can see the api request and I see that it gets a 200 response with the data i need, but it is not getting assigned to products variable and i do not get any errorrs.

I configured sandbox(doublechecked), I am using a real device(doublechecked).

Can anyone help me out? I am stuck.

iaphub commented 2 years ago

Hi @skayka,

It is probably the react-native-iap peer dependency that isn't installed correctly. Can you double check you've installed the version 5.2.6 ?

ovchinnikovs commented 2 years ago

I have the same problem only on Android and on iOS everything comes.

react-native-iap version is set to 5.2.6 but still doesn't work

the request passes and the method is called, but nothing is output to the console and no error comes maybe on android you need to add permission?

I used Android SDK 31