react-native-iap: getProducts and getSubscriptions returns empty array

Version of react-native-iap

3.4.11

Version of react-native

0.59.10

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

Currently, I’m only working on iOS.

Expected behavior

Should see auto-renewable subscriptions

Actual behavior

Receiving an empty array:

Screenshot 2019-09-20 at 08 08 52

Tested environment (Emulator? Real Device?)

Mainly tested in the Simulator (Although, I tried on a real device yesterday and it was still empty)

Steps to reproduce the behavior

So to clarify, I originally believed it to be because I had not finalised a tax form in the Agreements, Tax and Banking section of iTunes connect:

Screenshot 2019-09-19 at 17 26 47

However, this has now been completed:

Screenshot 2019-09-20 at 08 11 33

I have created two products with the product ids artistsannual and artistmonthly. My bundle id is com.iynk.iynk.

Screenshot 2019-09-20 at 08 12 50

They are both “Ready to Submit”.

My code:

const subscriptionSKUs = Platform.select({
  ios: ['artistmonthly', 'artistannual'],
  android: [''],
});

class Upsell extends React.Component {
  .
  .
  .
    async componentDidMount() {
    try {
      const result = await RNIap.initConnection();
      console.log('result', result);

      const subscriptions = await RNIap.getSubscriptions(subscriptionSKUs);
      console.log('subscriptions', subscriptions);

      const products = await RNIap.getProducts(subscriptionSKUs);
      console.log('products', products);
    .
    .
    .
    } catch (e) {
      console.log('Error handling in Upsell componentDidMount', e);
    }
  }
  .
  .
  .
}

The response is:

  • result: true
  • subscriptions: []
  • products: []

I have run react-native link react-native-iap.

I have also tried to implement revenuecat: https://github.com/RevenueCat/react-native-purchases Which is getting the Entitlements but not the products?

Do I need to “Submit the App” before Subscriptions and Products show up? How do you work on development products if this is the case?

I’m very stuck… Thanks in advance everyone!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 30 (2 by maintainers)

Most upvoted comments

Ok, I have resolved the problem with the use of this StackOverflow post: https://stackoverflow.com/questions/7947805/ios-in-app-purchase-no-products-received/11707704#11707704

The issue was that my bundleID was auto-created by react-native: org.reactjs.native.example.xxx. I had to change to be the correct one in all relevant files.

@Akshay-Chhikara Thank you for your reply. it works i just have to wait between the moment of its ready to submit and to getProducts.

For all just try to wait at least 24h

I solved it! I am using these versions,

react-native-iap: ^4.3.0 react-native: 0.60.5

just do it like this

const itemSkus = Platform.select({
    ios: [
        '100coins' // just remove bundle id from product id
    ],
    android: [
        '100coins' // just remove bundle id from product id
    ]
});

I know most fixes have been mentioned here, but it seems like I ran into every possible issue to cause an empty product response. Since there were so many possibilities, here is a collective checklist:

What to Check Locally:

  • Be sure you are calling getProducts in the initConnection callback
  • If your app changed names at one point, verify that the bundleId is correct in all files
  • Verify that you are passing the product sku array to getProducts (passing undefined will cause an empty response*) iOS Only:
  • in Xcode: Enable the IAP Capability in Main App Target (Target > Signing & Capabilities)
  • For testing in the iOS Emulator, setup products in a local Storekit configuration

What to Check for Production with iOS (App Store Connect):

  • Verify the bundleId matches in the Project and in the App Store Connect provisioning profile
  • Double check that all policies are accepted, that there are no issues with the bank account used, and that all contacts fields are filled out. You should show an “active” status for the Paid Apps Agreement
  • Be sure you are have IAP Capability enabled in the App’s Identifier (Apple Developer > Certificates > Identifiers)
  • If you have multiple provisioning profiles with the same bundle ID, select the provisioning profile manually. Automatic management does not choose the latest profile
  • If any of your IAP products show a “Missing Metadata” status, be sure to fill out the Review Information section (requires screenshot)

There are so many possible issues, I really hope this helps someone else.

*I was really surprised you could pass undefined to getProducts. Is there any reason this method needs to fail silently when the param is undefined? The fact I had it setup incorrectly after a transition from the old RNIAP setup, makes me wonder if it could be a possible common issue.

For me, On simulator it worked after adding store-kit configuration under schema. Only thing it will not work on simulator is receipt validation as simulator not giving proper receipt, but it worked on actual device for me

I know most fixes have been mentioned here, but it seems like I ran into every possible issue to cause an empty product response. Since there were so many possibilities, here is a collective checklist:

What to Check Locally:

  • Be sure you are calling getProducts in the initConnection callback
  • If your app changed names at one point, verify that the bundleId is correct in all files
  • Verify that you are passing the product sku array to getProducts (passing undefined will cause an empty response*) iOS Only:
  • in Xcode: Enable the IAP Capability in Main App Target (Target > Signing & Capabilities)
  • For testing in the iOS Emulator, setup products in a local Storekit configuration

What to Check for Production with iOS (App Store Connect):

  • Verify the bundleId matches in the Project and in the App Store Connect provisioning profile
  • Double check that all policies are accepted, that there are no issues with the bank account used, and that all contacts fields are filled out. You should show an “active” status for the Paid Apps Agreement
  • Be sure you are have IAP Capability enabled in the App’s Identifier (Apple Developer > Certificates > Identifiers)
  • If you have multiple provisioning profiles with the same bundle ID, select the provisioning profile manually. Automatic management does not choose the latest profile
  • If any of your IAP products show a “Missing Metadata” status, be sure to fill out the Review Information section (requires screenshot)

There are so many possible issues, I really hope this helps someone else.

*I was really surprised you could pass undefined to getProducts. Is there any reason this method needs to fail silently when the param is undefined? The fact I had it setup incorrectly after a transition from the old RNIAP setup, makes me wonder if it could be a possible common issue.

This was so helpful thank you!

@Pooj797 maybe try setting your getProducts to a specific product, and that way you can rule out an issue in the code. For example, but replace myProductName with one of your product skus you have setup:

RNIap.initConnection().then(output =>
     RNIap.getProducts('myProductName').then(products =>
         console.log(`Products: ${JSON.stringify}`)))

If setting it to a specific product allows you to get a products response, it means there is an issue with the code. Note: It will return an empty array if you pass ‘’ to getProducts. If you still get an empty array, you know it is an issue with the product or product name.

Hope that helps.

@MutableLoss thanks for reply Issue is fixed i am using store kit configuration file so response is not coming of app store connect product Id’s

@selimmidikoglu Sweet ! Changing my bundle id did the trick ! Awesome !

So basically there is no way to test in app purchases by having dev / staging / release environments with different bundle ids.

It should be written somewhere it’s not obvious at all I spent 3 days on this issue.

@bulby97 There were tons of

  • First thing was to check if all subscriptions were on stage ‘Ready to Submit’.

  • Second thing was to fill all the required things on itunnesconnect Agreement, Tax, Banking part. This part was kinda difficult because address field can not be filled with coorect address. You just need to submit 5 times. Apple is really interesting company.

  • I changed bundle ids in both xcode and itunnes connect. Than I tried to run app on real device.

  • Than boom my in app purchases was there.

As I see the problem genrally lie beneath by missing one step in configuration state. There is nothing related with code.

Ok, I have resolved the problem with the use of this StackOverflow post: https://stackoverflow.com/questions/7947805/ios-in-app-purchase-no-products-received/11707704#11707704

The issue was that my bundleID was auto-created by react-native: org.reactjs.native.example.xxx. I had to change to be the correct one in all relevant files.

Hi, @alexpchin I am having this same issue for 4 hours now and don’t know what to do. My bundleID was also created by RN. What exactly did you change to make it work??