-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.p: in_app_purchasePlugin for in-app purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: timeoutIssue is closed due to author not providing the requested details in timeIssue is closed due to author not providing the requested details in time
Description
Target Platform: IOS only. (Works on Android)
Issue: The app doesn't initialize the purchases until you click the button to buy again. In other words, the plugin doesn't verify previous purchases when opened.
Future<void> initializeIap() async {
iapAvailable = await _iap.isAvailable();
if (iapAvailable) {
await _getProducts();
await _getPastPurchases();
_subscription = _iap.purchaseUpdatedStream.listen((data) {
_purchases.addAll(data);
_verifyPurchase();
});
_verifyPurchase();
}
}
Future<void> _getPastPurchases() async {
QueryPurchaseDetailsResponse response = await _iap.queryPastPurchases();
//TODO: IOS Complete Purchases
for (PurchaseDetails purchase in response.pastPurchases) {
if (Platform.isIOS) {
InAppPurchaseConnection.instance.completePurchase(purchase);
}
}
_purchases = response.pastPurchases;
}
Future<void> _getProducts() async {
Set<String> ids = Set.from([offerId]);
ProductDetailsResponse response = await _iap.queryProductDetails(ids);
_products = response.productDetails;
notifyListeners();
}
Version 0.2.1
kofan, erluxman, miikaeru, fferraris, SalehHub and 35 moreThorbenl and gabrielmdcThorbenl and gabrielmdcThorbenl and gabrielmdcerluxman, chris-wolf, aylanexame and Thorbenl
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.p: in_app_purchasePlugin for in-app purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: timeoutIssue is closed due to author not providing the requested details in timeIssue is closed due to author not providing the requested details in time