React-native-iap: Results in empty response for getProducts!

Created on 21 Feb 2019  ·  13Comments  ·  Source: dooboolab/react-native-iap

Version of react-native-iap

"react-native-iap": "^2.4.1",

Version of react-native

RN 0.53+

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

IOS

Expected behavior

I need to implement and test this functionality in an app that I'll need to upload to apple connect

Actual behavior

results in empty response for getProducts

Tested environment (Emulator? Real Device?)

both

Steps to reproduce the behavior

my app information:
captura de tela 2019-02-21 as 10 59 31

my product information:
captura de tela 2019-02-21 as 10 59 46

i try with this code :

const itemSkus = Platform.select({
  ios: [
    'br.com.ousesaber.innap.usuariopremium'
  ],
  android: [
    'br.com.ousesaber.innap.usuariopremium'
  ]
});
getItems = async() => {
    try {
      const products = await RNIap.getProducts(itemSkus);
      // const products = await RNIap.getSubscriptions(itemSkus);
      console.log('Products', products);
      this.setState({ productList: products });
    } catch (err) {
      console.warn(err.code, err.message);
    }
  }

output:

Products Array []

I've been having enough problems with this, can anyone help me?

📱 iOS 🙏 help wanted

Most helpful comment

@tmjordan Android takes max 24hours to make it work if you've just uploaded purchase items.

All 13 comments

@13ArturBruno Have you checked the readme? If not, please try the steps there then come back.

Did you find out what could be happening?

My error has been solved! Just had pended on the agreements and tax.

Hi everyone, I have the same problem. I always get an empty array when calling getProducts

@hyochan @13ArturBruno

Please check the readme I've referred above and agreements and tax.

@hyochan i have to put my bank account information, and have an active state on paid applications contracts? If yes i will do it later.
But even on android i also receive an empty array.

@tmjordan Android takes max 24hours to make it work if you've just uploaded purchase items.

Ok thank you very much man, i will wait and i will let you know :)

Hi @hyochan, i have succeed to make it work on iOS, but still nothing on android, still getting an empty array. To test I'm using an android emulator with google play. Not sur if it is related.

I am facing the same issue, getting an empty array from the getProducts() method.

react-native-iap - 2.4.8 & react native version - 0.56.0.

It is working properly on native iOS with the same id.

How to resolve it?

@hyochan I was using InAppUtils module and the products were coming just fine, so I guess all the setup in Apple connect is OK.
But when I use getProducts I'm getting an empty array.

Using latest RN (0.60) and latest RNIap.

@dani-z did you fix this problem.me too getting empty array
this is my simplest code

im added this products 12 hours ago and deployed alpha and beta channels (beta still waiting)

const itemSkus = Platform.select({
  ios: [],
  android: ['1_number_weekly', 'one_number_weekly', 'two_number_weekly'],
});

async componentDidMount() {
    try {
      await RNIap.initConnection();
      console.log(itemSkus);
      const products = await RNIap.getSubscriptions(itemSkus);
      this.setState({products});
      console.log('products', products);
    } catch (err) {
      console.warn(err); // standardized err.code and err.message available
    }
  }

console log is

[Wed Aug 12 2020 13:45:29.643]  LOG      ["1_number_weekly", "one_number_weekly", "two_number_weekly"]
[Wed Aug 12 2020 13:45:29.765]  LOG      products []

image

Was this page helpful?
0 / 5 - 0 ratings