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.

2
  • 1
    Have you found any solution? I am having similar problem. Commented Jun 8, 2022 at 15:08
  • Same here. Any solution? Commented Jun 8, 2023 at 11:57

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

0

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'
]
});

1 Comment

Thank you!! After 10 hours of debugging it finally works! So sad I've spent so much time only because of poor documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.