getPurchaseHistory() and getAvailablePurchases() are not resolved / rejected
See original GitHub issueVersion of react-native-iap
4.4.4 The issue is reproduced on v 4.4.4 only, the 4.3.0 works like a charm
Version of react-native
0.61.5
Platforms you faced the error (IOS or Android or both?)
iOS
Expected behavior
getPurchaseHistory()
and getAvailablePurchases()
return purchases
Actual behavior
getPurchaseHistory()
and getAvailablePurchases()
aren’t resolved or rejected
Tested environment (Emulator? Real Device?)
Simulator (13.4), iPhone 8 Plus (13.4), iPhone X (13.4)
Steps to reproduce the behavior
Please see the code below:
const canMakePayments = await RNIap.initConnection()
if (!canMakePayments) {
dispatch(setAvailableIapProductsSuccess(null))
return
}
const products = await RNIap.getProducts(R.consts.IAP_SKUS)
logger.log('Available IAP: ' + JSON.stringify(products))
dispatch(setAvailableIapProductsSuccess(products))
try {
const pendingPurchases = await RNIap.get()
logger.log('Pending = ', JSON.stringify(pendingPurchases)) // => works fine
const availablePurchases = await RNIap.getAvailablePurchases() // => doesn't work
logger.log('Available purchases = ' + availablePurchases)
// the app never reaches here
const purchaseHistory = await RNIap.getPurchaseHistory() // => doesn't work
logger.log('Purchase history = ' + purchaseHistory)
} catch (err) {
logger.log(err)
}
Does anybody know how to fix that? I checked out the native code, as well as the bridge and all that seems fine.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (3 by maintainers)
Top Results From Across the Web
React Native: RNIap.getPurchaseHistory().then runs infinately
After pulling this commit, I deleted my node_modules and pods, and cleaned my build folder, but the askForPurchase() and buyProduct() functions ...
Read more >react-native-iap - npm
Once an item is consumed, it will no longer be available in getAvailablePurchases() and will only be available via getPurchaseHistory() .
Read more >dooboolab/react-native-iap (Raised $40.00) - Issuehunt
Task :react-native-iap:compileReleaseJavaWithJavac FAILED ... getPurchaseHistory() and getAvailablePurchases() are not resolved / rejected.
Read more >react-native native module for In App Purchase
getAvailablePurchases(), Promise<Purchase[]>, Get all purchases made by the user (either non-consumable, or haven't been consumed yet.
Read more >Check subscription validity using flutter_inapp_purchase ...
[Solved]-Check subscription validity using flutter_inapp_purchase dependency?-Flutter ... getAvailablePurchases() ); for (var purchase in purchases!)
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
incase anybody still facing this issue please don’t forget to initialize connection in component did mount and its safe to end connection when unmount, here are the methods from docs:
RNIap.initConnection(); RNIap.endConnection();
@hyochan 4.4.6 works perfectly, thanks a lot