{
    "componentChunkName": "component---src-pages-flutter-blog-js",
    "path": "/flutter-blog/",
    "result": {"data":{"featured":{"totalCount":1,"nodes":[{"id":"55e4d38d-e11d-5b62-af91-c3a273ec4f7a","uid":"subscriptions-in-flutter-the-complete-implementation-guide","first_publication_date":"2021-10-27T09:21:46+0000","last_publication_date":"2023-07-28T14:50:25+0000","data":{"meta_title":{"text":"Subscriptions in Flutter - Complete Implementation Guide"},"meta_description":{"text":"This complete integration will guide you from a no subscription flutter app to a solid implementation of subscriptions into your flutter app."},"title":{"text":"Subscriptions in Flutter - The Complete Implementation Guide"},"rich_text":{"text":"Hello, fellow flutter developers! This complete documentation will guide you from a no subscription flutter app to a solid implementation of subscriptions into your flutter app. Keep in mind that all successful subscription apps need to solve the 3 biggest problems for in-app purchases.  Typically, the IAP problems are not really known, so it is best to have a discussion with the team plus the product owner how to solve these problems to develop a successful subscription app. It sometimes also helps to just share an article with the responsible people to raise awareness. Our focus will be Auto-Renewable Subscriptions. Quick explanation: If a user purchases an Auto-Renewable Subscription, the user will be granted access to a special service or content for a week, a month, a quarter, 6 months or a year. The user can always decide to cancel or renew the subscription before the next period starts. There are 3 ways to implement subscriptions in your app. The first would be to integrate the official Android and iOS purchase libraries provided by Apple and Google. This would require you to write Swift and Kotlin and create a bridge to the flutter application.  To avoid re-inventing the wheel, the flutter devs created a package that manages the native implementation and created a bridge to your flutter app (option #2). If you use the flutter package, you only need to handle the flutter implementation of subscriptions and manually add your created subscription Ids and validate the receipt on your server.  The third way would be to use LinkFive, which uses the official flutter package but adds a dynamic layer on top of the official plugin and gives you the option to dynamically change your subscription offering even after you have released the app and also validates purchases with the LinkFive backend system. Flutter in_app_purchase or linkfive_purchases plugin Every so often, it is difficult to decide between different plugins. Here is a brief overview on the benefits of using the LinkFive Flutter plugin compared to the in_app_purchase plugin. Option 1: Use the Flutter Plugin in_app_purchase (Provider example) Luckily, there is a ready-to-use plugin that has already implemented the native Android and iOS integration of subscriptions for your app. The plugin uses the official Android and iOS libraries for subscriptions and creates a bridge to your Flutter app.  Let's start right away with the plugin. 1. Add the In-App Purchase Dependency Just add the dependency to your pubspec.yaml file or add the dependency with the flutter client: $ flutter pub add in_app_purchase in your pubspec.yaml: dependencies:\n  in_app_purchase: ^3.1.7 The version might be outdated already. Please check the latest version on Pub.dev 2. Initializing the Plugin and connecting to the underlying store You can read all the detailed steps on the official documentation. We will outline the key parts.  Listen for subscription purchase updates The plugin uses streams to communicate with the native subscription integration. You can use any state management system along with the plugin in your app. You can also just use a StatefulWidget, but it's not recommended. I would suggest the Provider or Riverpod package for your state management. There are other state management systems like bloc or getX, but for simplicity, we will focus on the provider package. Create a new file in your provider folder: subscriptions_provider.dart and listen for subscription updates. class SubscriptionsProvider extends ChangeNotifier {\n  \n  // save the stream to cancel it onDone\n  late StreamSubscription _streamSubscription;\n\n  SubscriptionsProvider() {\n    final Stream<List<PurchaseDetails>> purchaseUpdated = InAppPurchase.instance.purchaseStream;\n\n    _streamSubscription = purchaseUpdated.listen((purchaseDetailsList) {\n      // Handle the purchased subscriptions\n      _purchaseUpdate(purchaseDetailsList);\n\n    }, onDone: () {\n      _streamSubscription.cancel();\n\n    }, onError: (error) {\n      // handle the error\n    });\n  }\n\n  _listenToPurchaseUpdated(List<PurchaseDetails> purchaseDetailsList) {\n    // Purchased Subscriptions\n  }\n} The provider will listen to purchase updates whenever you start consuming the SubscriptionProvider. Let's jump directly into the method. _purchaseUpdate(List<PurchaseDetails> purchaseDetailsList) {\n\n  // check each item in the provider list\n  purchaseDetailsList.forEach((PurchaseDetails purchaseDetails) async {\n\n    // Sometimes the purchase is not completely done yet, in this case, show the pending UI again.\n    if (purchaseDetails.status == PurchaseStatus.pending) {\n      _showPendingUI();\n\n    } else {\n\n      // The status is NOT pending, lets check for an error\n      if (purchaseDetails.status == PurchaseStatus.error) {\n        // This happens if you close the app or dismiss the purchase dialog.\n        _handleError(purchaseDetails.error!);\n\n      } else if (purchaseDetails.status == PurchaseStatus.purchased ||\n          purchaseDetails.status == PurchaseStatus.restored) {\n\n        // Huge SUCCESS! This case handles the happy case whenever the user purchased or restored the purchase\n        _verifyPurchaseAndEnablePremium(purchaseDetails);\n\n      }\n\n      // Whenever the purchase is done, complete it by calling complete.\n      if (purchaseDetails.pendingCompletePurchase) {\n        await InAppPurchase.instance.completePurchase(purchaseDetails);\n      }\n    }\n  });\n} It is significant to confirm the purchase. If your app does not confirm the purchase, it will be automatically revoked by Google or Apple after 3 days and the amount will be refunded to the user. Whenever the status is purchased or restored, we have to check if the purchase is valid and if true, show the premium features according to the subscription plan. _verifyPurchaseAndEnablePremium(PurchaseDetails purchaseDetails){\n  \n  // check if the purchase is valid by calling your server including the receipt data.\n  bool valid = await _verifyPurchase(purchaseDetails);\n  if (valid) {\n\n    // Purchase is valid, time to enable all subscription features.\n    _enablePremiumFeatures(purchaseDetails);\n\n  } else {\n    \n    // The receipt is not valid. Don't enable any subscription features.\n    // _handleInvalidPurchase(purchaseDetails);\n  }\n} In any case, you should verify that a subscription is valid on your server by sending the receipt data to your server's endpoint and calling either Apple or Google to verify whether it is valid or not. In 2022, Apple introduced the new App Store Server API which can be used to query the transaction without the receipt. All you need is a working server to server App Store connection and the user‘s transactionId. You could also skip this part but this will open your business to false-positive subscribers.  3. Connect to the underlying store and receive your subscription data Whenever you think it's time to offer your subscriptions to your user, you need to get subscription data such as the price, the currency and the duration of the subscription. If you started from scratch, there are probably no subscriptions created on the Google Play Store and Apple App Store yet. This is expected and not an issue. You can continue with the integration and replace the subscription Ids later on.  Let's create another method inside the subscriptions_provider.dart to fetch the information we need. fetchSubscriptions() async {\n  final bool available = await InAppPurchase.instance.isAvailable();\n  if (!available) {\n    // The store cannot be reached or accessed.\n    // This could also be the case if you run the app on emulator.\n    // Please use a physical device for testing.\n    return;\n  }\n\n  // Hardcode subscriptionIds you want to offer.\n  const Set<String> _subscriptionIds = <String>{'sub1', 'sub2'};\n  final ProductDetailsResponse response = await InAppPurchase.instance.queryProductDetails(_subscriptionIds);\n\n  if (response.notFoundIDs.isNotEmpty) {\n    // IDs that does not exist on the underlying store.\n  }\n\n  // all existing product are inside the productDetails.\n  List<ProductDetails> products = response.productDetails;\n\n  // Store the subscription and notify all listeners\n  notifyListeners();\n} You can now show the subscriptions you want to offer and update your UI elements accordingly. Also, you need to add the subscription IDs manually, which makes it very difficult to change the subscription offer. You may want to try LinkFive to dynamically add the subscriptions to your app and change the subscriptions in seconds without creating and uploading a new app version.  4. Purchase a subscription To make a purchase, you need to call the purchase method with the productDetail the user selected. A subscription is a non-consumable product since the user can only purchase a subscription once at a time. once the subscription is active, the user cannot purchase it again. If the subscription has ended or got cancelled by the user, the subscription can be purchased again. // prepare the PurchaseParam\nPurchaseParam purchaseParam = PurchaseParam(productDetails: productDetails); \n\n// Purchase the Subscription\nInAppPurchase.instance.buyNonConsumable(purchaseParam: purchaseParam); The purchase flow should start now and will call the subscription listener in any case on success or error.  5. Restore a subscription If the user pressed on the restore button of your paywall (which is required on iOS), call the restorePurchases method. This will fetch all existing subscriptions and deliver them to the purchase listener which we created in the beginning. InAppPurchase.instance.restorePurchases();  6. Run the App without creating Google Play or App Store subscriptions If you provide the wrong subscription identifiers or did not create any Ids yet, the response notFoundIDs will be filled with the provided IDs. This is expected for the first run. If you start with Android, please upload your Android App to the Google Play Store and create your subscriptions afterwards. If you start with iOS, just go to App Store Connect and create your Subscriptions.  Option 2: Use the Flutter Plugin linkfive_purchases (Provider example) The plugin takes care of delivering the subscriptions IDs to your app by adding a layer between the in_app_purchase and adds much more flexibility to your flutter app. It automatically fetches the subscriptions which you can configure via the web app and adds additional functionality e.g. a dynamic paywall to your flutter app.  LinkFive also introduced a complete subscription user management in version 2.0.0 and above. A short overview can be found on our Flutter Integration page. Let's start by adding the plugin to your flutter project. 1. Add the LinkFive Purchases Dependency Add the dependency to your pubspec.yaml file or add the dependency with the flutter client: $ flutter pub add linkfive_purchases in your pubspec.yaml: dependencies:\n  linkfive_purchases: ^3.0.0 The version might be outdated already. Please check the latest version on LinkFive Pub.dev page  2. Add Subscriptions using the LinkFive Purchases Plugin It's really easy to implement subscriptions with LinkFive, there are only 3 steps to add subscriptions to your flutter app. First, you need to initialize the plugin with the provider API KEY. You can get your API key here. It's for free! // Get your API key after sign up\nawait LinkFivePurchases.init(\"LinkFive Api Key\");\n\n// Get all product offers before you show your offer to the user.\nLinkFivePurchases.fetchProducts(); 3. Listen to Subscription Updates Just listen to updates via the LinkFive Stream and show the result to the user: // Subscriptions to offer to the user \nLinkFivePurchases.products;\n\n// Active subscriptions the user purchased \nLinkFivePurchases.activeProducts; 4. Purchase the Subscription Purchase the product whenever the user clicks on the subscription. // This handles the entire purchase process\nLinkFivePurchases.purchase(productDetails);  That’s it, and enough to offer subscriptions to your users. Let's look into the provider example of the plugin. You can configure your Products inside LinkFive website    Use the ready-to-use Provider Plugin It's even easier with the LinkFive provider plugin available on pub.dev dependencies:\n  linkfive_purchases_provider: ^3.0.0 And all you need to do is to register the provider with the API Key. MultiProvider(\n  providers: [\n    // ...\n    ChangeNotifierProvider(\n      create: (context) => LinkFiveProvider(\"API_KEY\"),\n      lazy: false,\n    ),\n  ]\n) You can use the provider to check if there is an active subscription or to offer subscriptions to your user. Complete Provider Example If you would rather not use the LinkFive provider plugin, you can, of course, create your own provider. Let’s start with the provider file and create a new file with the name: linkfive_provider.dart in your provider folder. class LinkFiveProvider extends ChangeNotifier {\n  LinkFivePurchasesMain linkFivePurchases = LinkFivePurchasesMain();\n\n  LinkFiveProducts? products;\n  LinkFiveActiveProducts? activeProducts;\n\n  List<StreamSubscription> _streams = [];\n\n  LinkFiveProvider() {\n    linkFivePurchases.init(\"keys.linkFiveApiKey\");\n    linkFivePurchases.fetchProducts();\n    _streams.add(linkFivePurchases.products.listen(_productsUpdate));\n    _streams.add(linkFivePurchases.activeProducts.listen(_activeProductsUpdate));\n  }\n\n  void _productsUpdate(LinkFiveProducts data) async {\n    products = data;\n    notifyListeners();\n  }\n\n  void _activeProductsUpdate(LinkFiveActiveProducts data) {\n    activeProducts = data;\n    notifyListeners();\n  }\n\n  Future<LinkFiveProducts?> fetchProducts() {\n    return LinkFivePurchases.fetchProducts();\n  }\n\n  restoreSubscriptions() {\n    return LinkFivePurchases.restore();\n  }\n\n  Future<bool> purchase(ProductDetails productDetail) async {\n    return LinkFivePurchases.purchase(productDetail);\n  }\n\n  switchPlan(LinkFivePlan oldPurchasePlan, LinkFiveProductDetails productDetails,\n      {ProrationMode? prorationMode}) {\n    return LinkFivePurchases.switchPlan(oldPurchasePlan, productDetails,\n        prorationMode: prorationMode);\n  }\n\n  @override\n  void dispose() {\n    _streams.forEach((element) async {\n      await element.cancel();\n    });\n    _streams = [];\n    super.dispose();\n  }\n} The Provider is now ready to use in your App and you will see the LinkFive Debug messages: I/flutter (32079): LinkFive: Store reachable\nI/flutter (32079): LinkFive: push active sub data with size 0\nI/flutter (32079): LinkFive: set purchaseState value PurchaseState.NOT_PURCHASED   Flutter Custom Paywall UI Plugin An even easier and faster way to get started is with the custom Paywall UI Plugin available on pub.dev. The Plugin was made by LinkFive to easily add a paywall with the purchases plugin. The UI package offers a couple of designs that you can use in your app for free – even if you don't use LinkFive. Seamless integration with LinkFive Purchases Plugin The plugin works immediately together with the linkfive_purchase plugin. No additional work needed Only a few lines of code are required to display your subscriptions. SimplePaywall(\n  callbackInterface: LinkFivePurchases.callbackInterface,\n  subscriptionListData: subscriptionData,\n  // ...\n}); The subscriptionData can be built yourself by creating an Object of `SubscriptionData`. Here is an example how you can use the intl package to create the desired data. List<SubscriptionData>? _buildPaywallData(BuildContext context, LinkFiveProducts? products) {\n  if (products == null) {\n    return null;\n  }\n  final subList = <SubscriptionData>[];\n\n  for (final product in products.productDetailList) {\n    final pricingPhase = product.pricingPhases.first;\n    final durationStrings = pricingPhase.billingPeriod.jsonValue.fromIso8601(PaywallL10NHelper.of(context));\n    final data = SubscriptionData(\n      durationTitle: durationStrings.durationTextNumber,\n      durationShort: durationStrings.durationText,\n      price: pricingPhase.formattedPrice,\n      productDetails: product.productDetails,\n    );\n    subList.add(data);\n  }\n\n  return subList;\n} As an example, using the Provider plugin: Pass the callbackInterface from the provider and `List<SubscriptionData>` to the Paywall, and you're all set. Consumer<LinkFiveProvider>(\n  builder: (_, provider, __) {\n    // get subscription data from your provider or from your stream (as described above)\n    LinkFiveProducts? products = provider.products;\n\n    return PaywallScaffold(\n      child: SimplePaywall(\n      callbackInterface: LinkFivePurchases.callbackInterface,\n      subscriptionListData: _buildPaywallData(context, provider.products),\n      // ...\n    );\n  },\n); The result will show the subscriptions, and it will handle everything related to a purchase. The page is currently an empty paywall that you can customize yourself using the plugin. Out of the box Purchase State Management  The plugin also manages the UI state of the paywall, and the Plugin makes sure that either the success page or the premium page is displayed if the user has purchased Premium. You can always navigate to your premium page.  // no additional code needed Check out the Pub.dev page of the paywall plugin. Enable Subscriptions for Android Before you can create your subscriptions in the Google Play Store, Google wants you to upload an app version with the billing permission. You can also check if you already added the permission by going to the in-app products page in the developer console (Monetize > Products > In-app products). If it says: Your app doesn't have any in-app products yet - To add in-app products, you need to add the BILLING permission to your APK. Then you need to upload a new app version with the billing permissions first. Add the BILLING Permission to your APK Since 2017 it's not necessary to add the permission manually anymore. You can still add it manually but the permission will be merged automatically with the purchase library later. Add Permission Manually You can still add it manually, to do it, open the AndroidManifest.xml file. You can find the file in the following folder in your flutter project: android > app > src > main > AndroidManifest.xml Add the com.android.vending.BILLING Permission to the Manifest root section. <manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" \n    package=\"app.tnx.equixo\">\n    \n    <!-- other permissions -->\n    <uses-permission android:name=\"com.android.vending.BILLING\" />\n\n    <application\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\">\n        <!-- your activities -->\n Upload your App to the Google Play Store Now, build a new app version and upload it to your Alpha or internal track (Both work and are only for internal use) After you've successfully uploaded a new version, you can go ahead and create your subscriptions. "},"author_name":{"text":"Alexander Thiele"},"tag":"flutter","hero_image":{"alt":null,"url":"https://images.prismic.io/linkfive/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=0%2C46%2C960%2C448&w=1800&h=840","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#0858a8","images":{"fallback":{"src":"/static/13e8999de134d4da7d0dcfed68c6a344/d7441/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.png","srcSet":"/static/13e8999de134d4da7d0dcfed68c6a344/2a360/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.png 750w,\n/static/13e8999de134d4da7d0dcfed68c6a344/c7768/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.png 1080w,\n/static/13e8999de134d4da7d0dcfed68c6a344/ac867/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.png 1366w,\n/static/13e8999de134d4da7d0dcfed68c6a344/d7441/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.png 1800w","sizes":"100vw"},"sources":[{"srcSet":"/static/13e8999de134d4da7d0dcfed68c6a344/be179/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.webp 750w,\n/static/13e8999de134d4da7d0dcfed68c6a344/1eb10/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.webp 1080w,\n/static/13e8999de134d4da7d0dcfed68c6a344/e34d1/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.webp 1366w,\n/static/13e8999de134d4da7d0dcfed68c6a344/df00f/58f84166-c54f-4900-a296-fa8bcd562d1d_flutter_subscriptions.webp 1800w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.4666666666666667}}}},"featured":true}}]},"normal":{"totalCount":9,"nodes":[{"id":"9187e2bb-a2bb-58ed-ae4f-dc019b931c6a","uid":"state-of-flutter-in-app-purchase-may-2022-update","first_publication_date":"2022-05-10T09:31:30+0000","last_publication_date":"2022-05-10T09:56:06+0000","data":{"meta_title":{"text":""},"meta_description":{"text":""},"title":{"text":"The State of Flutter In-App Purchase (May 2022 Update)"},"rich_text":{"text":"What's new in May 2022, and what happened to the plugins around In-App Purchases on Flutter in the last few months?  Plugin in_app_purchase 3.0.2 Release The Flutter team has released version 3.0.2 of the official in_app_purchase plugin. This is a breaking change for all Apps that still uses the older version 2.0.2. But why do they release a breaking change so soon after the version 2? The team accidentally did not include all changes in version 2.0.0. Here are the changes: The most significant change occurs on the restorePurchases functionality. Whenever you restore a purchase, the plugin will now always emit a list to the purchaseStream. If there is nothing to restore, the stream will contain an empty list now. This behaviour was in v2 already on Android and now also applies to iOS. Everything else remains the same. Here is the Plugin on pub.dev  Plugin linkfive_purchases 2.0.2 Release  LinkFive updated the plugin to the latest Flutter version 2.10.4 and added extended Subscription User Management to the newest version. In addition, LinkFive is preparing its plugin to integrate Flutter Web Subscriptions and had to implement some breaking changes for this. As of version 2, the core of LinkFive are Plans. A Plan is either active or inactive, it does not matter if the plan was purchased from Google Play Store, from Apple App Store, from Web or from the Blockchain via Bitcoin or other currencies. Each plan belongs to a subscription group and a subscription tier. The app receives the active Plan, including its group / tier, and can enable the underlying features, including the information in which store the purchase was made. It's now also possible to manually enable an active plan to certain user with the new User Management.  Each App user now also receives a unique LinkFive user ID, which is unique for each user device. The Unique LinkFive ID can be combined with the App's User ID and enables features such as Multi-Platform active subscriptions. You can find the plugin on pub.dev.  Plugin in_app_purchases_paywall_ui 0.6.0 Release The new version 0.6.0 updates the theme to the latest Flutter version and mainly uses the colorScheme to colour the UI. The plugin also removes the option to pass a theme to the widget and uses Theme.of(context) now. If you're using the plugin, make sure to update your global theme or wrap the plugin in a Theme(..) widget. The plugin itself is a UI widget with various designs for your Paywall. There is also an easy to use LinkFive implementation. Here is the plugin on pub.dev.                 "},"author_name":{"text":"Alexander Thiele"},"tag":"flutter","hero_image":{"alt":null,"url":"https://images.prismic.io/linkfive/fe35cbb6-0987-48e3-bdd7-5d930d34e8f7_flutter-in-app-purchase-may-2022-update.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=0%2C0%2C672%2C313&w=1000&h=466","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#f8f8e8","images":{"fallback":{"src":"/static/6d50d107c6f7b3851ae4232e78fbddcc/6f055/fe35cbb6-0987-48e3-bdd7-5d930d34e8f7_flutter-in-app-purchase-may-2022-update.png","srcSet":"/static/6d50d107c6f7b3851ae4232e78fbddcc/2a360/fe35cbb6-0987-48e3-bdd7-5d930d34e8f7_flutter-in-app-purchase-may-2022-update.png 750w,\n/static/6d50d107c6f7b3851ae4232e78fbddcc/6f055/fe35cbb6-0987-48e3-bdd7-5d930d34e8f7_flutter-in-app-purchase-may-2022-update.png 1000w","sizes":"100vw"},"sources":[{"srcSet":"/static/6d50d107c6f7b3851ae4232e78fbddcc/be179/fe35cbb6-0987-48e3-bdd7-5d930d34e8f7_flutter-in-app-purchase-may-2022-update.webp 750w,\n/static/6d50d107c6f7b3851ae4232e78fbddcc/15cf6/fe35cbb6-0987-48e3-bdd7-5d930d34e8f7_flutter-in-app-purchase-may-2022-update.webp 1000w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.466}}}},"featured":false}},{"id":"03aac404-94f8-5296-af1c-cb94ad0ca95e","uid":"how-to-add-subscriptions-with-flutter-using-linkfive","first_publication_date":"2022-04-22T12:49:52+0000","last_publication_date":"2022-04-22T12:49:52+0000","data":{"meta_title":{"text":""},"meta_description":{"text":""},"title":{"text":"How to add Subscriptions with Flutter using LinkFive"},"rich_text":{"text":"Hello, fellow flutter developers! Integrating subscriptions can often be very tiring and difficult. This post is about how to integrate subscriptions into Flutter with LinkFive step by step. So let's get started...  1. Add the Flutter Plugin Add the linkfive_purchases plugin to your pubspec.yaml $ flutter pub add linkfive_purchases\n\n// or\n\ndependencies:\n  linkfive_purchases: ^2.0.0 Read the getting started guide in our docs. The LinkFive Purchases Plugin can be found on pub.dev as well.  2. Initialize LinkFive To initialize LinkFive, just call init. You can await the init call but it's not necessary to wait for it. Behind the scene, the plugin will generate a unique user session ID for the current user and device. You will be able to view the user inside the user management tab right after the init method is finished. await LinkFivePurchases.init(\"LinkFive Api Key\"); Sign up here to get an API KEY. It's free!   3. Fetch all available Subscriptions for your Flutter Paywall This is an example of a Subscription Paywall UI: The Paywall shows 3 options: 1 month for 2,99€ 3 months for 8,99€ and 12 months for 14,99€ These are the plans that the app wants to offer to the user. To fetch those plans, you should first connect either the Apple App Store or Google Play Store to LinkFive. After you've connected a Store, the subscriptions are instantly visible in your Flutter App using the fetchProducts method. // call fetchProducts() to get all available offers\nLinkFivePurchases.fetchProducts(); Usually, you don't want to call this method right after initializing LinkFive since a user who already purchased a subscription doesn't want to load the data every time they open the app. That's why we suggest fetching the products when the user enters your Flutter Paywall UI. Pro Tip: You can customize which subscriptions you want to offer for a certain country, a specific time or also for just a single user. Read more about the Subscription Playout here.  Access the subscription product data The LinkFive plugin mainly uses Streams to distribute the data to your app. In your Provider, BLoC Cubit, riverpod hook or StreamBuilder, you just need to listen to the LinkFive products. LinkFivePurchases.products.listen(_productsUpdate)\n\nvoid _productsUpdate(LinkFiveProducts data) {\n  // access LinkFiveProducts data\n} The LinkFiveProducts contain a list of your available subscription offer including the ProductDetails. Let's maybe start with a simple print of the data. You can also read our docs. LinkFivePurchases.products.listen(_productsUpdate)\n\nvoid _productsUpdate(LinkFiveProducts data) {\n  for (LinkFiveProductDetails lfProductDetails in data.productDetailList){\n\n      // The Subscription Duration\n      print(lfProductDetails.duration); // P1M\n\n      // The Native Product Detail from the App or Play Store\n      ProductDetails productDetails = lfProductDetails.productDetails;\n\n      print(productDetails.id);\n      print(productDetails.title);\n      print(productDetails.description);\n      print(productDetails.price);\n      print(productDetails.rawPrice);\n      print(productDetails.currencySymbol);\n      print(productDetails.currencyCode);\n  }\n} The ProductDetails can be a type of GooglePlayProductDetails or AppStoreProductDetails (depending on your current device)   if (productDetails is GooglePlayProductDetails) {\n\n    GooglePlayProductDetails googleDetails = productDetails as GooglePlayProductDetails;\n\n  }\n\n  if (productDetails is AppStoreProductDetails) {\n\n    AppStoreProductDetails iosDetails = productDetails as AppStoreProductDetails;\n\n  } The GooglePlayProductDetails or AppStoreProductDetails contain more information on the subscription for each platform. But usually, you're not required to cast the productDetails. Ready to Show your Flutter Paywall With the information above, you can go ahead and display the subscription to the user. 4. Make a Purchase When the user clicks on a subscription, you should make a real purchase with the underlying App Store or Play Store. Luckily, LinkFive helps you to make it as simple as possible.  In the example above, you have the ProductDetails. To make a purchase, just call purchase with the LinkFive Plugin. LinkFivePurchases.purchase(productDetails); And that's it. The native Purchase dialogue will open and the user can choose to make the purchase or cancel the process. Need more information? Read our make a flutter purchase docs.  5. Listen to Purchase Updates The big question now is, did the user successfully complete the purchase or cancel it? Same with the previous product offering, you can also listen to all activeProducts. Active Products are subscriptions, that have been either purchased through the App Stores, with our web client (web subscriptions) or created as a custom user plan from one of your customer support employees. Again, in your Provider, BLoC Cubit, riverpod hook or StreamBuilder, you just need to listen to the LinkFive activeProducts. LinkFivePurchases.activeProducts.listen(_activeProductsUpdate)\n\nvoid _activeProductsUpdate(LinkFiveActiveProducts data) {\n  // access LinkFiveActiveProducts data\n} Let's print the active product plan data. LinkFivePurchases.activeProducts.listen(_activeProductsUpdate)\n\nvoid _activeProductsUpdate(LinkFiveActiveProducts data) {\n\n  for(LinkFivePlan lfPlan in data.planList){\n\n    print(lfPlan.duration);\n    print(lfPlan.planId);\n    print(lfPlan.rootId);\n    print(lfPlan.productId);\n    print(lfPlan.endDate);\n    print(lfPlan.isTrial);\n    print(lfPlan.customerUserId);\n    print(lfPlan.familyName);\n    print(lfPlan.storeType);\n    print(lfPlan.attributes);\n\n  }\n} You can then enable any premium plan feature in your flutter app now. Note: Only active plans will be available through the activeProducts Stream.  Congratulations, you have added Flutter Subscriptions with LinkFive There are some more features available using our flutter plugin like upgrading a subscription plan. Please check out our docs for more information. "},"author_name":{"text":"Alexander Thiele"},"tag":null,"hero_image":{"alt":"Add Flutter Subscriptions using LinkFive","url":"https://images.prismic.io/linkfive/6f798450-b132-4b51-9452-0278f048dc0c_Flutter%20Subscriptions%20LinkFive.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=0%2C92%2C1920%2C895&w=1000&h=466","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#f8f8f8","images":{"fallback":{"src":"/static/265fc192bc66e5e01723246acc716a5e/6f055/6f798450-b132-4b51-9452-0278f048dc0c_Flutter%2BSubscriptions%2BLinkFive.png","srcSet":"/static/265fc192bc66e5e01723246acc716a5e/2a360/6f798450-b132-4b51-9452-0278f048dc0c_Flutter%2BSubscriptions%2BLinkFive.png 750w,\n/static/265fc192bc66e5e01723246acc716a5e/6f055/6f798450-b132-4b51-9452-0278f048dc0c_Flutter%2BSubscriptions%2BLinkFive.png 1000w","sizes":"100vw"},"sources":[{"srcSet":"/static/265fc192bc66e5e01723246acc716a5e/be179/6f798450-b132-4b51-9452-0278f048dc0c_Flutter%2BSubscriptions%2BLinkFive.webp 750w,\n/static/265fc192bc66e5e01723246acc716a5e/15cf6/6f798450-b132-4b51-9452-0278f048dc0c_Flutter%2BSubscriptions%2BLinkFive.webp 1000w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.466}}}},"featured":false}},{"id":"ec1f1002-257c-5b7f-a04c-3f11f636cd4e","uid":"linkfive-v2-release-now-with-subscription-management","first_publication_date":"2022-04-07T05:57:40+0000","last_publication_date":"2022-05-10T09:37:52+0000","data":{"meta_title":{"text":"LinkFive v2 Release - Now with Subscription User Management "},"meta_description":{"text":"We have been successfully working the last few months on v2 of LinkFive and are proud to roll out the new version on production this week!"},"title":{"text":"LinkFive v2 Release - Now with Subscription User Management "},"rich_text":{"text":"We have been successfully working the last few months on v2 of LinkFive and are proud to roll out the new version on production this week! The latest version paves the way for us to integrate other payment providers such as web subscriptions via Stripe and Paypal, as well as Google Play and Apple App Store subscriptions. We are integrating a new version of our user management and linking users to payments in a new way. With the newest update, we will be able to develop a new user interface for all our LinkFive customers where all users and their premium status will be visible and manually adjustable. This will enable all customers to provide successful customer support to their users. Please update your libraries to at least v2.0.0. Our subscription management in detail Since the last update of Apple Notifications, it is possible to map the complete subscription status of a user with purely notification updates. Therefore, we are switching our user management to Google and Apple notifications. Whenever a user renews or cancels their subscription, we receive a notification and can edit the user's status and update your app. Upcoming features We will first roll out this change to all our customers and make sure that every single user is securely shifting to the new system.  Next, we will focus on the user management view of our website. All users will be searchable by our user id or your own customer id. This feature will be FREE for all our customers! We will be heading to web subscriptions later this year. Stay tuned!"},"author_name":{"text":"Alexander Thiele"},"tag":"flutter","hero_image":{"alt":"LinkFive v2 Release","url":"https://images.prismic.io/linkfive/d3abe5e2-4370-4248-9ca0-c96335ad47fd_v2%20release%20banner.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=0%2C4%2C732%2C341&w=1000&h=466","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#f8f8e8","images":{"fallback":{"src":"/static/c85f349fdd0920a5b16786678f8ab4f0/6f055/d3abe5e2-4370-4248-9ca0-c96335ad47fd_v2%2Brelease%2Bbanner.png","srcSet":"/static/c85f349fdd0920a5b16786678f8ab4f0/2a360/d3abe5e2-4370-4248-9ca0-c96335ad47fd_v2%2Brelease%2Bbanner.png 750w,\n/static/c85f349fdd0920a5b16786678f8ab4f0/6f055/d3abe5e2-4370-4248-9ca0-c96335ad47fd_v2%2Brelease%2Bbanner.png 1000w","sizes":"100vw"},"sources":[{"srcSet":"/static/c85f349fdd0920a5b16786678f8ab4f0/be179/d3abe5e2-4370-4248-9ca0-c96335ad47fd_v2%2Brelease%2Bbanner.webp 750w,\n/static/c85f349fdd0920a5b16786678f8ab4f0/15cf6/d3abe5e2-4370-4248-9ca0-c96335ad47fd_v2%2Brelease%2Bbanner.webp 1000w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.466}}}},"featured":false}},{"id":"5e9e42b5-32f7-51bb-8d82-6a3c0120a794","uid":"google-new-subscription-policy-starting-january-2022","first_publication_date":"2021-12-16T17:06:06+0000","last_publication_date":"2021-12-16T17:06:06+0000","data":{"meta_title":{"text":""},"meta_description":{"text":"Google added two new paragraphs and new examples to the Subscriptions policy which will take effect on January 17, 2022."},"title":{"text":"Google has a new subscription policy starting January 2022"},"rich_text":{"text":"Google added two new paragraphs and new examples to the Subscriptions policy which will take effect on January 17, 2022. You can read the official statement here.  To summarize the changes You must be transparent with your subscription offer and don't mislead your user. Use subscriptions when there is a recurring value and use an in-app product for everything else. If you offer a free trial, you have to show when the free trial ends and what will be charged afterwards. That's probably nothing new to most of the apps which means you probably don't have to change anything in your subscription offer. We advise all subscription apps to check their paywalls and read the Examples of violations. There are also prepared images of actual violations. Free Trials & Introductory Offers Google now set rules for free trials and introductory offers. You now have clearly shown when the free trial will end and what the user will be charged afterwards. It's forbidden to just write \"Try for free now\" and then open the purchase dialogue.  Our Flutter Paywall UI plugin meets all of these criterias We're happy to say that our Flutter paywall UI plugin meets all google's criteria. We currently don't offer a special UI for free trials but we will add the free trial UI in a future release of our flutter plugin. Read more in our Flutter Complete implementation Guide.  Header Image by Google      "},"author_name":{"text":"Alexander Thiele"},"tag":null,"hero_image":{"alt":null,"url":"https://images.prismic.io/linkfive/afbdf005-281b-41d4-872a-952520d5f329_ZErNX8IBOj6fWaWTN5D5bQuHotBvLAZK4rTu.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=0%2C5%2C1050%2C489&w=1000&h=466","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#58d8e8","images":{"fallback":{"src":"/static/2a2a4e041aad4fbf8201802da20d24c7/6f055/afbdf005-281b-41d4-872a-952520d5f329_ZErNX8IBOj6fWaWTN5D5bQuHotBvLAZK4rTu.png","srcSet":"/static/2a2a4e041aad4fbf8201802da20d24c7/2a360/afbdf005-281b-41d4-872a-952520d5f329_ZErNX8IBOj6fWaWTN5D5bQuHotBvLAZK4rTu.png 750w,\n/static/2a2a4e041aad4fbf8201802da20d24c7/6f055/afbdf005-281b-41d4-872a-952520d5f329_ZErNX8IBOj6fWaWTN5D5bQuHotBvLAZK4rTu.png 1000w","sizes":"100vw"},"sources":[{"srcSet":"/static/2a2a4e041aad4fbf8201802da20d24c7/be179/afbdf005-281b-41d4-872a-952520d5f329_ZErNX8IBOj6fWaWTN5D5bQuHotBvLAZK4rTu.webp 750w,\n/static/2a2a4e041aad4fbf8201802da20d24c7/15cf6/afbdf005-281b-41d4-872a-952520d5f329_ZErNX8IBOj6fWaWTN5D5bQuHotBvLAZK4rTu.webp 1000w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.466}}}},"featured":false}},{"id":"671cb936-5c89-5361-b99c-47a817b9444f","uid":"in_app_purchase-plugin-2-0-0-released","first_publication_date":"2021-12-13T19:24:18+0000","last_publication_date":"2021-12-13T19:25:46+0000","data":{"meta_title":{"text":"in_app_purchase Plugin Update 2.0.0 - Whats new"},"meta_description":{"text":"The Flutter team recently update the flutter plugin in_app_purchase to version 2.0.0. We've checked the changes and here is what is new."},"title":{"text":"in_app_purchase Plugin Update 2.0.0 - Whats new?"},"rich_text":{"text":"The Flutter team recently update the flutter plugin in_app_purchase to version 2.0.0. We've checked the changes and here is what is new. What's new in version 2.0.0 Version 2.0.0 has breaking changes and your project will probably need to be adjusted, but don't worry. Only the package names have been changed and a simple renaming should fix the issue.  New PurchaseStatus The most interesting change is the addition of the new PurchaseStatus.canceled. You can now determine if a purchase got cancelled by the user or by a purchase error.       switch (purchaseDetails.status) {\n        case PurchaseStatus.pending:\n          // Pending\n          break;\n        case PurchaseStatus.error:\n          // Purchase Error\n          break;\n        case PurchaseStatus.canceled:\n          // User Cancelled\n          break;\n        case PurchaseStatus.purchased:\n          // Purchase Successful\n          break;\n        case PurchaseStatus.restored:\n          // Purchase Restored\n          // BTW: if there are many purchases, this will be triggered many many times.\n          super.isPendingPurchase = false;\n          break;\n      }  Android Changes Google Play no longer accepts App submissions that don't support pending purchases. it‘s now no longer necessary to acknowledge this through code by calling InAppPurchaseAndroidPlatformAddition.enablePendingPurchases();  You can delete this code fragment in version 2.0.0 and upwards:     if (defaultTargetPlatform == TargetPlatform.android) {\n      InAppPurchaseAndroidPlatformAddition.enablePendingPurchases();\n    }  iOS Changes The sub plugin in_app_purchase_ios has been renamed to in_app_purchase_storekit. This is no breaking change if you only use the package in_app_purchase. If you use the platform-specific package like the AppStoreProductDetails, then this is a BREAKING CHANGE and you have to change the package name. From import 'package:in_app_purchase_ios/in_app_purchase_ios.dart'; to import 'package:in_app_purchase_storekit/in_app_purchase_storekit.dart'; Other than the package the following class names changed as well: Renames InAppPurchaseIosPlatform to InAppPurchaseStoreKitPlatform RenamesInAppPurchaseIosPlatformAddition to InAppPurchaseStoreKitPlatformAddition There are no logic changes. More Changes restorePurchases now always emits an empty list of purchases (was different on iOS before) Adds support for promotional offers on the store_kit_wrappers Dart API.  LinkFive Purchases Changes For LinkFive users of our linkfive_purchases plugin: There should be no breaking changes for you. Our next version will adapt the version 2.0.1 and everything will work for you!   "},"author_name":{"text":"Alexander Thiele"},"tag":null,"hero_image":{"alt":null,"url":"https://images.prismic.io/linkfive/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=0%2C0%2C1000%2C466&w=1000&h=466","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#f8f8f8","images":{"fallback":{"src":"/static/4e613f33233ee0da0c64105105255fc0/6f055/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.png","srcSet":"/static/4e613f33233ee0da0c64105105255fc0/2a360/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.png 750w,\n/static/4e613f33233ee0da0c64105105255fc0/6f055/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.png 1000w","sizes":"100vw"},"sources":[{"srcSet":"/static/4e613f33233ee0da0c64105105255fc0/be179/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.webp 750w,\n/static/4e613f33233ee0da0c64105105255fc0/15cf6/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.webp 1000w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.466}}}},"featured":false}},{"id":"1d662130-f7e8-53ec-b0c7-fa12c1291635","uid":"flutter-purchases-plugin-1-5-0","first_publication_date":"2021-11-25T09:57:47+0000","last_publication_date":"2021-11-25T09:57:47+0000","data":{"meta_title":{"text":""},"meta_description":{"text":""},"title":{"text":"LinkFive Purchases Plugin Update 1.5.0"},"rich_text":{"text":"We just published our new linkfive_purchases version 1.5.0. Checkout the latest version on pub.dev. What‘s new LinkFivePurchases.fetchSubscriptions() had no return value in version 1.3.0. In version 1.4.0 we returned a future of List<ProductDetails> which is correct but was missing the Subscription attributes.  In version 1.5.0 we added the attributes again and LinkFivePurchases.fetchSubscriptions() now returns a Future of LinkFiveSubscriptionData. The LinkFiveSubscriptionData contains a List of LinkFiveProductDetails which represents the subscription product (It's now the same as LinkFivePurchases.products) listenOnResponseData is now deprecated and won't be replaced. We just used the method internally and should not be used in a production app. LinkFiveVerifiedReceipt has a new getter. We added subscriptionDuration which contains the duration of the subscription. The duration is an of Type SubscriptionDuration. Possible values are:  P1W P1M P3M P6M P1Y We also added more documentation to the code. Along with the update of 1.5.0 we also released the provider version 1.5.0 New to LinkFive? Go to our Documentation!"},"author_name":{"text":"Alexander Thiele"},"tag":null,"hero_image":{"alt":null,"url":"https://images.prismic.io/linkfive/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=1%2C0%2C999%2C466&w=1800&h=840","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#f8f8f8","images":{"fallback":{"src":"/static/cbba5c7a57f03e54e28f8c2395008030/d7441/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.png","srcSet":"/static/cbba5c7a57f03e54e28f8c2395008030/2a360/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.png 750w,\n/static/cbba5c7a57f03e54e28f8c2395008030/c7768/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.png 1080w,\n/static/cbba5c7a57f03e54e28f8c2395008030/ac867/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.png 1366w,\n/static/cbba5c7a57f03e54e28f8c2395008030/d7441/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.png 1800w","sizes":"100vw"},"sources":[{"srcSet":"/static/cbba5c7a57f03e54e28f8c2395008030/be179/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.webp 750w,\n/static/cbba5c7a57f03e54e28f8c2395008030/1eb10/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.webp 1080w,\n/static/cbba5c7a57f03e54e28f8c2395008030/e34d1/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.webp 1366w,\n/static/cbba5c7a57f03e54e28f8c2395008030/df00f/5d849b6c-8745-4592-81ac-0920dc107434_flutter_purchases_release1-5-0.webp 1800w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.4666666666666667}}}},"featured":false}},{"id":"dd49d4ce-9174-5a80-a1c8-29c928ad6610","uid":"react_native_sdk_available","first_publication_date":"2021-10-25T07:53:56+0000","last_publication_date":"2021-10-25T07:53:56+0000","data":{"meta_title":{"text":""},"meta_description":{"text":""},"title":{"text":"LinkFive React Native SDK available!"},"rich_text":{"text":"Today, we are thrilled to announce the LinkFive React Native SDK! Besides our native android and ios solutions and our Flutter SDK, we are also expanding our SDK family with the very popular React Native. Find the SDK here."},"author_name":{"text":"Nini"},"tag":null,"hero_image":{"alt":null,"url":"https://images.prismic.io/linkfive/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=0%2C144%2C1200%2C560&w=1800&h=840","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#080808","images":{"fallback":{"src":"/static/e2070dbd830e6fd46bc1f12a832282a3/d7441/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.png","srcSet":"/static/e2070dbd830e6fd46bc1f12a832282a3/2a360/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.png 750w,\n/static/e2070dbd830e6fd46bc1f12a832282a3/c7768/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.png 1080w,\n/static/e2070dbd830e6fd46bc1f12a832282a3/ac867/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.png 1366w,\n/static/e2070dbd830e6fd46bc1f12a832282a3/d7441/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.png 1800w","sizes":"100vw"},"sources":[{"srcSet":"/static/e2070dbd830e6fd46bc1f12a832282a3/be179/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.webp 750w,\n/static/e2070dbd830e6fd46bc1f12a832282a3/1eb10/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.webp 1080w,\n/static/e2070dbd830e6fd46bc1f12a832282a3/e34d1/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.webp 1366w,\n/static/e2070dbd830e6fd46bc1f12a832282a3/df00f/40d0525e-6ed5-4ee5-b5e9-8aab4444f4e1_1200px-React-icon.svg.webp 1800w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.4666666666666667}}}},"featured":null}},{"id":"b9c40278-fca7-565e-9331-add50b4621b6","uid":"storekit-2-what-has-changed","first_publication_date":"2021-10-22T08:50:56+0000","last_publication_date":"2021-10-22T10:05:54+0000","data":{"meta_title":{"text":"StoreKit 2 - What has changed?"},"meta_description":{"text":"StoreKit 2 - What has changed? Apple introduced StoreKit 2 for in app purchases. What is new?\b"},"title":{"text":"StoreKit 2 - What has changed?"},"rich_text":{"text":"With StoreKit 2, Apple has released at the WWDC21 a much-improved version of the unwieldy framework we’ve all had to deal with so far. According to Apple, the main keys to StoreKit 2 are: It’s designed Swift-first Powerful new APIs Simple and secure transactions Customer support Testing Support So let’s take a brief look to what has changed! StoreKit 2 Swiftyness As already mentioned before, StoreKit 2 has been designed with a Swift-first mindset and takes all the advantages like async & await Swift has to offer. This also means that StoreKit 2 is only available for iOS 15 and upwards. StoreKit 2 vs StoreKit 1 So what’s so swifty about StoreKit 2? to answer the question, let’s just examine the differences between the old and the new version of StoreKit! StoreKit 1 To fetch products in StoreKit 1 you had to do something like this: let request = SKProductsRequest(productIdentifiers: Set([\"linkfive.subscription.premium\", \"linkfive.subscription.light\"]))\nrequest.delegate = self\nrequest.start() extension ExamplePurchases: SKProductsRequestDelegate {\n\n    public func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {\n        let products = response.products\n        /// Do something with the products\n    }\n\n    public func request(_ request: SKRequest, didFailWithError error: Error) {\n        /// Do something with the error\n    }\n} So what you basically do, is requesting the products with the given ids and attach the SKProductsRequestDelegate which receives an SKProductsResponse object with the products in it when the request completes. Yikes! StoreKit 2 Now let’s take a look at the StoreKit 2 way: func fetchProducts() async throws -> [Product] {\n    let products = try await Product.request(with: Set([\"linkfive.subscription.premium\", \"linkfive.subscription.light\"]))\n    return products\n} Et voilà! That’s it! No delegate foo anymore, just straight up async/await sugar. If you also look at the other APIs, the new syntax runs through like a red thread. This definitely makes the development much easier and faster than before! The new APIs Refunds Developers are now able to add a “Request refund” button to their apps. A tap on the button opens another form where customers can request a refund with some additional information. The request does not go to the developers themselves, but to Apple, who is going to review the refund. Invoice / Refunds Lookup These are basically API’s which return the transaction / refund history for the given customer_order_id. Conclusion StoreKit 2 is a huge step into the right direction. It’s API is much cleaner, more understandable and in all ways better to use. It’s definitely a great gift for all the developers out there! But if you would like to have more control over your subscriptions and manage them properly, you are at the right place! LinkFive will help you to drive your subscription game up. Feel free to sign up now and enjoy the rich advantages we offer to you."},"author_name":{"text":"Nini"},"tag":null,"hero_image":{"alt":"Introducing StoreKit 2","url":"https://images.prismic.io/linkfive/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%202021-10-22%20um%2010.24.17.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=542%2C0%2C1016%2C474&w=1800&h=840","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#080808","images":{"fallback":{"src":"/static/bc730c133a017335e0f02b031b7956df/d7441/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%2B2021-10-22%2Bum%2B10.24.17.png","srcSet":"/static/bc730c133a017335e0f02b031b7956df/2a360/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%2B2021-10-22%2Bum%2B10.24.17.png 750w,\n/static/bc730c133a017335e0f02b031b7956df/c7768/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%2B2021-10-22%2Bum%2B10.24.17.png 1080w,\n/static/bc730c133a017335e0f02b031b7956df/ac867/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%2B2021-10-22%2Bum%2B10.24.17.png 1366w,\n/static/bc730c133a017335e0f02b031b7956df/d7441/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%2B2021-10-22%2Bum%2B10.24.17.png 1800w","sizes":"100vw"},"sources":[{"srcSet":"/static/bc730c133a017335e0f02b031b7956df/be179/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%2B2021-10-22%2Bum%2B10.24.17.webp 750w,\n/static/bc730c133a017335e0f02b031b7956df/1eb10/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%2B2021-10-22%2Bum%2B10.24.17.webp 1080w,\n/static/bc730c133a017335e0f02b031b7956df/e34d1/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%2B2021-10-22%2Bum%2B10.24.17.webp 1366w,\n/static/bc730c133a017335e0f02b031b7956df/df00f/1a5d2b60-e5e5-4a02-b94a-d6ee72548d9a_Bildschirmfoto%2B2021-10-22%2Bum%2B10.24.17.webp 1800w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.4666666666666667}}}},"featured":null}},{"id":"14fe0486-3285-5987-8cff-c680431f20c4","uid":"welcome-to-our-flutter-tech-blog","first_publication_date":"2021-10-21T12:51:24+0000","last_publication_date":"2022-04-07T06:33:50+0000","data":{"meta_title":{"text":"Welcome to our Flutter Tech Blog"},"meta_description":{"text":"This is our new and shiny home for anything related to Flutter, Subscriptions, Android, iOS, Google Play Store and Apple App Store."},"title":{"text":"Welcome to our Flutter Tech Blog"},"rich_text":{"text":"This is our new and shiny home for anything related to Flutter, Subscriptions, Android, iOS, Google Play Store and Apple App Store. We will inform you about all the important infos you need to stay up to date! Flutter Tech Blog One part will be our Flutter Tech Blog where we will cover every detail of how to add subscriptions to your flutter app - even without LinkFive.  Of course, it's simpler with LinkFive but this is not where we will talk about it 😁 iOS & Android Tech Blog Another part will be our iOS and Android Tech Blog. Here we will talk about the latest SDK changes, latest architecture changes and things you should know.  But for now... We wish you a great week, a great year and lots of revenue with your subscription app! "},"author_name":{"text":"Alexander Thiele"},"tag":null,"hero_image":{"alt":null,"url":"https://images.prismic.io/linkfive/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.png?ixlib=gatsbyFP&auto=compress%2Cformat&fit=max&rect=0%2C4%2C732%2C342&w=1800&h=840","localFile":{"childImageSharp":{"gatsbyImageData":{"layout":"fullWidth","backgroundColor":"#0858a8","images":{"fallback":{"src":"/static/0fb4d598da34d2f214a6d81ac3c72ee5/fc1bb/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.png","srcSet":"/static/0fb4d598da34d2f214a6d81ac3c72ee5/2a360/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.png 750w,\n/static/0fb4d598da34d2f214a6d81ac3c72ee5/be921/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.png 1080w,\n/static/0fb4d598da34d2f214a6d81ac3c72ee5/b422e/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.png 1366w,\n/static/0fb4d598da34d2f214a6d81ac3c72ee5/fc1bb/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.png 1798w","sizes":"100vw"},"sources":[{"srcSet":"/static/0fb4d598da34d2f214a6d81ac3c72ee5/be179/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.webp 750w,\n/static/0fb4d598da34d2f214a6d81ac3c72ee5/47341/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.webp 1080w,\n/static/0fb4d598da34d2f214a6d81ac3c72ee5/a943b/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.webp 1366w,\n/static/0fb4d598da34d2f214a6d81ac3c72ee5/140a1/fb7b8dbb-b522-4b5d-8bdc-50e072952624_linkfive-flutter-blog-welcome-img.webp 1798w","type":"image/webp","sizes":"100vw"}]},"width":1,"height":0.4671857619577308}}}},"featured":false}}]}},"pageContext":{}},
    "staticQueryHashes": []}