react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

getProducts always returns an empty array on android

Open pixlerSanjay opened this issue 3 months ago • 1 comments

const productSkus = Platform.select({ ios: ['abc', 'abc2'], android: ['abc', 'abc2'], default: [], });

export const getAllPurchasePlans = async productSkus => { try { await RNIap.initConnection(); // Flush failed purchases cached as pending on Android if (Platform.OS === 'android') { const isFlushSuccessful = await RNIap.flushFailedPurchasesCachedAsPendingAndroid();

  if (!isFlushSuccessful) {
    console.log('No failed purchases cached as pending.');
    // Handle the case where there are no failed purchases cached as pending
  } else {
    console.log('Failed purchases cached as pending flushed successfully.');
  }
}
const products = await RNIap.getProducts({skus: productSkus});
console.log('-products----------->->->->', productSkus, products);
return products;

} catch (error) { //console.error('Error fetching products:', error); return []; } };

this is my code but its always return me empty array have any solution so please share here....

pixlerSanjay avatar Apr 08 '24 06:04 pixlerSanjay