'React Native Invalid Product ID in In-App Purchases

enter image description herethis is my code where i am getting products added on app store. before i was was working fine. when i remove the previous products on app store and added new then it's stop working. i removed the previous products from app store but still i can get that products by using their id. i clear build restart xcode but nothing works.

  const itemSkus = Platform.select({
    ios: ['pkg01', 'pkg02'],
    android: ['pkg01', 'pkg02'],
  });
  useEffect(() => {
    initializeConnection();

    purchaseUpdateSubscription = purchaseUpdatedListener(async purchase => {
      const receipt = purchase.transactionReceipt;
      if (receipt) {
        try {
          if (Platform.OS === 'ios') {
            RNIap.finishTransactionIOS(purchase.transactionId);
          }
          console.log('receipt: ', purchase.transactionReceipt);
        } catch (e) {
          console.warn(e);
        }
      }
    });
  }, []);

  const initializeConnection = async () => {
    try {
      const result = await RNIap.initConnection();
      console.log('connection is => ', result);
      
      if (result) {
        await getProducts()
      }
    } catch (err) {
      console.log('error in cdm => ', err);
    }
  };
  const getProducts = async () => {
     const products = await RNIap.getProducts(itemSkus);
      console.log('Products', products);
      setProductList(products);
  }


 


Solution 1:[1]

This might be a combination of a few things:

  1. Apple could be caching the old product IDs, it may take some time but they will become unavailable.
  2. The new product IDs might need to be reviewed/approved by Apple to ensure they abide by their rules before they are made available. Until that happens you won't be able to access them for in app purchases.

Solution 2:[2]

After many tryies (with clean project), I have figured out that problem occures when I add add_subdirecory command to the CMakeLists.txt. For now I stick to the idea that problem is bound to this issue https://github.com/microsoft/vscode-cmake-tools/issues/1596 (though, I don't use configurationProvider).

P.S.: project I try to add is xlnt (https://github.com/tfussell/xlnt).

Solution 3:[3]

I made a clean project, transferred the project files there and now everything works as it should. Probably the problem was in some settings of the project, but I could not find in which ones. Sorry for disturbing.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zach Jensz
Solution 2
Solution 3 nshibalov