Flutter not finding any products for in-app purchases

You need to use a reserved SKU for the test: android.test.purchased

When using in_app_purchase:

const List<String> _kProductIds = <String>[
  'android.test.purchased'
];
ProductDetailsResponse productDetailResponse =
  await _connection.queryProductDetails(_kProductIds.toSet());

In my case In-App purchase working fine in Android but not worked in ios

After lots of struggle found that bundle id project.pbxproj in this file is different than I define in runner

this file location is

projectdirectory -> ios -> Runner.xcodeproj

check bundle id that assigns to PRODUCT_BUNDLE_IDENTIFIER

I hope this may save someone time


I just had this same problem (notFoundIds) while using flutter plugin in_app_purchase. So two things to be ensured:

  1. Ensure productId is registered in PlayStore/AppStore as specified by plugin readme;

  2. Before calling queryProductDetails, call isAppPurchaseAvailable which will initialise and wait a bit until it is ready, then queryProductDetails will work. Sample code below:

       Future<List<ProductDetails>> loadProductsForSale() async {
         if(await isAppPurchaseAvailable()) {
           const Set<String> _kIds = {APP_PRODUCTID01};
           final ProductDetailsResponse response =
           await InAppPurchaseConnection.instance.queryProductDetails(_kIds);
           if (response.notFoundIDs.isNotEmpty) {
             debugPrint(
                 '#PurchaseService.loadProductsForSale() notFoundIDs: ${response
                     .notFoundIDs}');
           }
           if (response.error != null) {
             debugPrint(
                 '#PurchaseService.loadProductsForSale() error: ${response.error
                     .code + ' - ' + response.error.message}');
           }
           List<ProductDetails> products = response.productDetails;
           return products;
         } else{
           debugPrint('#PurchaseService.loadProductsForSale() store not available');
           return null;
         }
       }
    
     Future<bool> isAppPurchaseAvailable() async {
     final bool available = await InAppPurchaseConnection.instance.isAvailable();
    
     debugPrint('#PurchaseService.isAppPurchaseAvailable() => $available');
    
     return available;
     if (!available) {
       // The store cannot be reached or accessed. Update the UI accordingly.
    
       return false;
     }
     }
    

This answer is somewhat of a recommendation, however, it should take you to your goal.

The Flutter team has recently finished an official plugin for in-app purchases. It is the in_app_purchase plugin.

  1. I assume that you have already read through the Android Developers guide for configuring your remove_ads purchase.

  2. You need to add in_app_purchase as a dependency in your pubspec.yaml file:

dependencies:
  in_app_purchase: ^0.3.1 # For newer versions, check the Pub page.
  1. In your Flutter app, you now need to import 'package:in_app_purchase/in_app_purchase.dart':
import 'package:in_app_purchase/in_app_purchase.dart';
  1. To load your product, you can use the following code:
// Set literals require Dart 2.2. Alternatively, remove `const` and use `<String>['remove_ads'].toSet()`.
const Set<String> _kIds = {'remove_ads'};
final ProductDetailsResponse response = await InAppPurchaseConnection.instance.queryProductDetails(_kIds);
if (!response.notFoundIds.isEmpty()) {
    // Handle the error.
} else {
  List<ProductDetails> products = response.productDetails;
  for (ProductDetails product in products) {
    print('${product.title}: ${product.description} (cost is ${product.price})');
  }
  // Example: purchasing the first available item.
  final PurchaseParam purchaseParam = PurchaseParam(productDetails: products[0]);
  InAppPurchaseConnection.instance.buyNonConsumable(purchaseParam: purchaseParam);
}

For more information and instructions, read the plugin's README and checkout the example app.

  1. You need to follow the steps explained in the example's README. You will need to create a remove_ads SKU ID instead of what they mention because their SKU IDs only apply to the example.