getProducts returns empty array in react-native-iap

550 views Asked by At

getProducts and getSubscriptions from useIAP hook return always undefined and products and subscriptions are always empty arrays. getProducts imported from react-native-iap is also returning an empty array but getSubscriptions is undefined.

Expected Behavior

I am trying to fetch products from apple but i'm getting undefined or empty array, i completed all steps about configuring in app purchases in app store connect, i added product skus. I am expecting to receive an array of my products added earlier in app store connect.

You can take look to screenshots for further explanation about my in app purchases products and how i'm fetching them in my app. screenshots provide used code.code screenshot from project

screenshot of product in app store connect enter image description here

Environment:

react-native-iap: 12.10.7 react-native: 0.71.8 Platforms (iOS, Android, emulator, simulator, device): IOS, simulator

Steps to reproduce the behavior:

  1. add in app purchase in app store connect and in make available in xcode
  2. add in app purchase products
  3. try to fetch them from ios app in ios simulator

Additional context:

The app is not published and not yet submitted in app store or testflight, i have not uploaded any bundle to app store yet, i'm matching the sku in app store with bundle identifier in xcode.

In agreements and banking section, i have an agreement for free apps, can it be the problem ?

Screenshot from banking and agreements section in app store connect

All solutions in already opened issues in SO were tested without success.

2

There are 2 answers

0
MarvRocks On

I've got similar problems. Maybe try to use getAvailablePurchases instead of getProducts. As I understand, getAvailablePurchases is for non-consumables.

0
Zeeshan On

I didnt select All region for poducts only one country selected,

selecting All region for each products on store work for me.