In App Purchases in Flutter
Why Stack Overflow recommends it
Stack Overflow users link it as the tutorial they followed when building Flutter in-app purchases, and use it as a reference point when asking about problems like empty product lists, iOS crashes and purchase verification.
Recommended by 1 people across 1 different months, 2019 to 2024.
What it is
A Fireship tutorial showing how to set up in-app purchases in a Flutter app using the official in_app_purchase plugin, with a focus on selling consumable digital products on both iOS and Android. It walks through the setup and links to the Flutter deployment docs for the App Store and Google Play.
What people said
Recommends deandrehaijiel · 2024-06 · Stack Overflow · on “flutter buying in app subscription crashes iOS”
I am trying to integrate in app subscriptions into my app, I am using the in_app_purchase package [LINK] . I followed the tutorial here: [this video] . Everything is working just fine in Android. However, every time I call the _buyProduct method in iOS, the app crashes but the payment sheet pops up in the home screen. Is anyone facing the same thing or does anyone have any advice? TIA. Future<void> _initialize() async { // Check availability of In App Purchases _available = await _iap.isAvailable(); if (_available) { await _getProducts(); await _getPastPurchases(); _verifyPurchase(); // Listen to new purchases _subscription = _iap.purchaseStream.listen((data) { // Create a temporary list to store
Cites rafaelsm · 2019-08 · Stack Overflow · on “Flutter In App Purchase: InAppPurchaseConnection.instance.queryProductDetails returns empty list”
I'm following this video: [this video] and I'm using an Android device. When I try to get the products from the google play console I'm getting an empty list in this section. Future<void> _getProducts() async { Set<String> ids = <String>['credits_test'].toSet(); ProductDetailsResponse response = await InAppPurchaseConnection.instance.queryProductDetails(ids); setState(() { _products = response.productDetails; if(response.productDetails.isNotEmpty){ print(response.productDetails.elementAt(0)); } else{ print("void list"); } }); } I also try this page: [LINK] My code: class _MyHomePageState extends State<MyHomePage> { //Interface InAppPurchaseConnection _iap = InAppPurchaseConnection.instance; bool
Cites DavidGetter · 2020-01 · Stack Overflow · on “Flutter - How to verify InAppPurchases (iOS)”
I've tried to implement in-app purchases of non-consumable items but I got stuck with the verification of the purchase, atleast on iOS. Whenever I make the function "_verifyPurchase()" just return true, everything is fine. That's what makes me think that the verifying process is the problem. Future<bool> _verifyPurchase(String productID) async { final appState = Provider.of<AppState>(context); PurchaseDetails purchase = await _hasPurchased(productID); SharedPreferences prefs = await SharedPreferences.getInstance(); print('verify'+purchase?.productID.toString()+(purchase?.error).toString()); if (purchase != null && (purchase.status == PurchaseStatus.purchased || purchase.transactionDate != nu
Cites Dani · 2020-02 · Stack Overflow · on “Purchase fails Flutter flutter_inapp_purchase”
do you know any good tutorial about subscriptions and upgrade? I only found this one but it's about consumable: [this video]