3

I am following this library to implement In App Purchase for react native project.

Project info:-

inside package.json

"dependencies": {
    "react": "16.11.0",
    "react-native": "0.61.5",
    "react-native-iap": "^4.4.9"
},

And I am trying to get product list,

import * as RNIap from 'react-native-iap';

const itemSkus = Platform.select({
  ios: [
    'com.cooni.point1000',
    'com.cooni.point5000', // dooboolab
],
android: [
   'com.example.coins100'
]
});


try {
  const result = await RNIap.initConnection();
  await RNIap.consumeAllItemsAndroid();
  console.log('result', result);

  if(result == true){

    console.log("itemSkus>>>", itemSkus)

    const products = await RNIap.getSubscriptions(itemSkus);

    console.log("getting_products>>>", products)

    this.setState({ products });
  }
  
} catch(err) {
  console.warn(err); // standardized err.code and err.message available
}

I am getting true for initConnection but getting [] (empty array) for getSubscriptions and also for getProducts()

By the way, I am getting empty array also for project which is in testFlight for using subscription ids that I have created. Those are in "Waiting for review state"

enter image description here

Is it not possible to get result using above test iap ids and ids that are in "Waiting for review state"?

How can I get response either using example or real ids?

Any help should be appreciable.

Exigente05
  • 2,161
  • 3
  • 22
  • 42

3 Answers3

0

These are the possible solutions please check The products are not in the 'Ready To Submit' state (make sure you've added the screenshot). You haven't signed your Paid Applications Agreement in App Store Connect You're testing on an emulator instead of a physical device.

Rahul Shakya
  • 1,269
  • 15
  • 15
0

My experience with RN-IAP for iOS was that it is super-unreliable, and plagued with issues where it works differently from documentation, and differently from Android version. The best solution I found was to switch to RevenueCat service for purchase management - that works great, after about an year of use I have not encountered any issues or differences between Android and iOS.

Sergey Pogodin
  • 406
  • 2
  • 6
-1

I was having the same problem and found that it worked if I removed the bundle ID from iOS product ID.

const itemSkus = Platform.select({
  ios: [
    'point1000',
    'point5000', // dooboolab
],
android: [
   'com.example.coins100'
]
});
wtmcm
  • 307
  • 1
  • 4
  • 19