Flutter In App Purchases For Humans.
This plugin makes it easy to make products or subscriptions for both Apple App Store and Google Play.
You can use the built-in
SubscriptionManager which provides a Stream interface for purchase states and abstracts away most of the logic around subscription management. However, it does not perform extended validation of a Subscription, so it may be possible to inject an invalid Subscription depending on the platform and device security settings. It is recommended that you perform server-side validation of all purchases, if that is a concern.
In App Purchases (Non-subscription Products)
You can run the included example app on an Android device to test the payment flow with test product SKUs.
Determine if Billing is available on the device.
final bool billingEnabled = await FlutterPayments.billingEnabled;
Fetch Product metadata from the store.
final List<Product> getProducts = await FlutterPayments.getProducts( skus: <String>[ 'android.test.purchased', 'android.test.canceled', ], type: ProductType.InApp, );
List<Purchase> purchase = await FlutterPayments.purchase( sku: 'android.test.purchased', type: ProductType.InApp, );
Get the User's purchase history from the Store. Returns a list of Purchase instances.
final List<Purchase> purchaseHistory = await FlutterPayments.getPurchaseHistory(ProductType.InApp); print('purchaseHistory: $purchaseHistory');
- Built-in types and core primitives for a Flutter application. [...]
- Support for asynchronous programming, with classes such as Future and Stream. [...]
- Classes and utilities that supplement the collection support in dart:core. [...]
- Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
- Built-in types, collections, and other core functionality for every Dart program. [...]
- Interact with developer tools such as the debugger and inspector. [...]
- Mathematical constants and functions, plus a random number generator. [...]
- Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]
- File, socket, HTTP, and other I/O support for non-web applications. [...]
- Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]