react-native-iap
react-native-iap copied to clipboard
getProducts always returns an empty array on android
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....