A comprehensive Flutter plugin for implementing in-app purchases that conforms to the Open IAP specification
📖 Visit our comprehensive documentation site →
dependencies:
flutter_inapp_purchase: ^6.4.0
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
// Create instance
final iap = FlutterInappPurchase();
// Initialize connection
await iap.initConnection();
// Get products
final products = await iap.requestProducts(
skus: ['product_id'],
type: PurchaseType.inapp,
);
// Request purchase
await iap.requestPurchase(
request: RequestPurchase(
ios: RequestPurchaseIOS(sku: 'product_id'),
android: RequestPurchaseAndroid(skus: ['product_id']),
),
type: PurchaseType.inapp,
);
For global state management or when you need a shared instance:
// Use singleton instance
final iap = FlutterInappPurchase.instance;
await iap.initConnection();
// The instance is shared across your app
final sameIap = FlutterInappPurchase.instance; // Same instance
MIT License - see LICENSE file for details.