flutter_inapp_purchase
A comprehensive Flutter plugin for implementing in-app purchases that conforms to the Open IAP specification
๐ Documentation
๐ Visit our comprehensive documentation site โ
๐ฆ Installation
flutter pub add flutter_inapp_purchase
For manual pubspec.yaml edits, copy the current dependency from the
flutter_inapp_purchase pub.dev package page.
iOS/macOS Native Dependency Resolution
No manual Package.swift or Podfile entry is required. On Flutter 3.44 and
newer, Swift Package Manager is enabled by default and the Flutter CLI resolves
the native OpenIAP dependency automatically when you run or build the app.
Projects that disable Swift Package Manager, or projects using an older Flutter
toolchain, continue to use CocoaPods. Run pod install after flutter pub get
for each Apple target you use:
(cd ios && pod install)
# If your app also has a macOS target:
(cd macos && pod install)
Apple platform targets require iOS 15.0+ or macOS 14.0+.
๐ง Quick Start
Basic Usage
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
// Create instance
final iap = FlutterInappPurchase();
// Initialize connection
await iap.initConnection();
// Fetch products with explicit type
final products = await iap.fetchProducts<Product>(
skus: ['product_id'],
type: ProductQueryType.InApp,
);
// Request purchase (builder DSL)
await iap.requestPurchaseWithBuilder(
build: (builder) {
builder
..type = ProductQueryType.InApp
..android.skus = ['product_id']
..ios.sku = 'product_id';
},
);
Using with AI Assistants
flutter_inapp_purchase provides AI-friendly documentation for Cursor, GitHub Copilot, Claude, and ChatGPT.
Quick links:
- llms.txt - Quick reference
- llms-full.txt - Full API reference
Development
See CONTRIBUTING.md for development setup and guidelines.
Singleton Usage
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
Powered by OpenIAP
flutter_inapp_purchase conforms to the OpenIAP specification โ an open, vendor-neutral interoperability standard for in-app purchases. OpenIAP provides:
- Shared specification โ Common types, error codes, and purchase flows across all platforms
- Generated type-safe bindings โ Swift, Kotlin, Dart, and GDScript from a single GraphQL schema
- Platform implementations โ openiap-apple (StoreKit 2) and openiap-google (Play Billing 8.x)
- Verification profiles โ Standardized receipt validation and purchase verification patterns
Other libraries built on OpenIAP: react-native-iap ยท expo-iap ยท kmp-iap ยท godot-iap
Learn more about the OpenIAP standard โ
Community
Have a question or need help? Ask in flutter_inapp_purchase Q&A Discussions.
For bug reports, please open an issue.
Sponsors
๐ผ View Our Sponsors
๐ License
MIT License - see LICENSE file for details.
Libraries
- builders
- enums
- errors
- Error types for flutter_inapp_purchase (OpenIAP compliant)
- events
- extensions/purchase_helpers
- flutter_inapp_purchase
- helpers
- types
- utils
- webhook_client
