Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getProducts always returns an empty array on android #2723

Open
pixlerSanjay opened this issue Apr 8, 2024 · 0 comments
Open

getProducts always returns an empty array on android #2723

pixlerSanjay opened this issue Apr 8, 2024 · 0 comments

Comments

@pixlerSanjay
Copy link

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....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant