iaphub / react-native-iaphub

The easiest way to implement IAP (In-app purchase) in your React Native app.
https://www.iaphub.com/
MIT License
320 stars 21 forks source link

getProductsForSale() not returning all products #36

Closed rbruels closed 3 years ago

rbruels commented 3 years ago

I've been killing myself on this one.

I cannot get getProductsForSale() to return more than one product, even though I have two fully setup in the IAPHub Dashboard and on App Store Connect.

On App Store Connect, one product is already for sale and live on the store, the other is "Ready for Review" but the "Cleared for Sale" checkbox is checked. Both of them are non-consumable (not subscriptions).

react-native-iap: 4.6.3 react-native-iaphub: 5.1.0

Here's the code I'm using (somewhat simplified/overstylized for clarity):

    import IAPHub from 'react-native-iaphub';
    ...
    const deviceId = DeviceInfo.getUniqueId();
    IAPHub.init({
      appId: '[removed my appID]',
      apiKey: '[removed my apiKey]',
      environment: 'production',
    })
    .then(() => {
      IAPHub.setUserId(deviceId)
      .then(() => {
        IAPHub.getProductsForSale()
        .then((products) => {
          console.log(products);  // *** here's where I'm expecting two products to return, but only get one... or zero...
        })
        .catch(err => {
          console.log(err);
        });
      })
      .catch(err => {
        console.log(err);
      });
    })
    .catch(err => {
      console.log(err);
    });

My device is only returning ONE of the TWO in-app purchases from getProductsForSale().

Strangely, the result seems to change if I change the userID. For a while, one user was returning [] from getProductsForSale(). I changed its userID and then it started returning one product. But not two.

If it helps, the product being returned is the one currently for sale on the App Store.

No errors are returned.

Am I missing the correct way to get ALL products for sale?

iaphub commented 3 years ago

Hi @rbruels,

I believe it could be one of your product that isn't returned by Itunes for some reason (misconfiguration maybe?). Do you have any error "Product sku not found" in the console? Could you please contact us at support@iaphub.com and give us your appId so we can take a look?

Thank you

iaphub commented 3 years ago

Closing the issue, if you're still having the issue you can contact us at support@iaphub.com.