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

Error getAvailablePurchases() #96

Closed
Emberice86 opened this issue Apr 4, 2018 · 2 comments
Closed

Error getAvailablePurchases() #96

Emberice86 opened this issue Apr 4, 2018 · 2 comments

Comments

@Emberice86
Copy link

Version of react-native-iap 0.3.0-beta5

Expected behavior Receive list of user's purchases

Actual behavior Receive next Error:

{
framesToPop:1,
code: E_NOT_PREPARED,
line:135,
column:4004,
sourceURL:"index.android.bundle"
}

Steps to reprodue the behabior

try {
const purchases = await RNIap.getAvailablePurchases();
let purchase = '';
purchases.forEach(p => {
if (p.productId === PREMIUM_ANDROID_SUBSCRIBE_ID) {
purchase = PURCHASED;
}
});
return purchase;
} catch (err) {
showAlert('ERROR getAndroidPurchases', JSON.stringify(err));
return '';
}
};

@neilco
Copy link
Contributor

neilco commented Apr 4, 2018

@Emberice86 Did you call await RNIap.prepare() before calling await RNIap.getAvailablePurchases()?

@Emberice86
Copy link
Author

Man, thanks a lot! I absolutely forgot about this! You saved my time!

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

2 participants