{
    "componentChunkName": "component---src-templates-flutter-blog-post-js",
    "path": "/flutter-blog/in_app_purchase-plugin-2-0-0-released/",
    "result": {"data":{"prismicFlutterPost":{"_previewable":"YbeXThIAACIA7le8","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","lang":"en-us","data":{"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!   ","raw":[{"type":"paragraph","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.","spans":[{"start":52,"end":67,"type":"strong"},{"start":79,"end":84,"type":"strong"}]},{"type":"heading2","text":"What's new in version 2.0.0","spans":[]},{"type":"paragraph","text":"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.","spans":[]},{"type":"paragraph","text":"","spans":[]},{"type":"heading3","text":"New PurchaseStatus","spans":[]},{"type":"paragraph","text":"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.","spans":[]},{"type":"preformatted","text":"      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      }","spans":[]},{"type":"paragraph","text":"","spans":[]},{"type":"heading3","text":"Android Changes","spans":[]},{"type":"paragraph","text":"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(); ","spans":[{"start":156,"end":219,"type":"em"}]},{"type":"paragraph","text":"You can delete this code fragment in version 2.0.0 and upwards:","spans":[]},{"type":"preformatted","text":"    if (defaultTargetPlatform == TargetPlatform.android) {\n      InAppPurchaseAndroidPlatformAddition.enablePendingPurchases();\n    }","spans":[]},{"type":"paragraph","text":"","spans":[]},{"type":"heading3","text":"iOS Changes","spans":[]},{"type":"paragraph","text":"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.","spans":[{"start":15,"end":34,"type":"strong"},{"start":55,"end":79,"type":"strong"},{"start":203,"end":225,"type":"strong"}]},{"type":"paragraph","text":"From","spans":[]},{"type":"preformatted","text":"import 'package:in_app_purchase_ios/in_app_purchase_ios.dart';","spans":[]},{"type":"paragraph","text":"to","spans":[]},{"type":"preformatted","text":"import 'package:in_app_purchase_storekit/in_app_purchase_storekit.dart';","spans":[]},{"type":"paragraph","text":"Other than the package the following class names changed as well:","spans":[]},{"type":"list-item","text":"Renames InAppPurchaseIosPlatform to InAppPurchaseStoreKitPlatform","spans":[{"start":8,"end":32,"type":"strong"},{"start":36,"end":65,"type":"strong"}]},{"type":"list-item","text":"RenamesInAppPurchaseIosPlatformAddition to InAppPurchaseStoreKitPlatformAddition","spans":[{"start":0,"end":39,"type":"strong"},{"start":43,"end":80,"type":"strong"}]},{"type":"paragraph","text":"There are no logic changes.","spans":[]},{"type":"heading3","text":"More Changes","spans":[]},{"type":"list-item","text":"restorePurchases now always emits an empty list of purchases (was different on iOS before)","spans":[]},{"type":"list-item","text":"Adds support for promotional offers on the store_kit_wrappers Dart API.","spans":[]},{"type":"paragraph","text":"","spans":[]},{"type":"heading3","text":"LinkFive Purchases Changes","spans":[]},{"type":"paragraph","text":"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!","spans":[{"start":26,"end":51,"type":"hyperlink","data":{"link_type":"Web","url":"https://www.linkfive.io/docs/flutter/get-started/"}}]},{"type":"paragraph","text":"","spans":[]},{"type":"paragraph","text":"","spans":[]},{"type":"paragraph","text":"","spans":[]}]},"title":{"text":"in_app_purchase Plugin Update 2.0.0 - Whats new?"},"hero_image":{"alt":null,"localFile":{"childImageSharp":{"fluid":{"aspectRatio":2.150537634408602,"src":"/static/4e613f33233ee0da0c64105105255fc0/ee604/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.png","srcSet":"/static/4e613f33233ee0da0c64105105255fc0/69585/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.png 200w,\n/static/4e613f33233ee0da0c64105105255fc0/497c6/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.png 400w,\n/static/4e613f33233ee0da0c64105105255fc0/ee604/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.png 800w,\n/static/4e613f33233ee0da0c64105105255fc0/31987/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.png 1000w","sizes":"(max-width: 800px) 100vw, 800px","base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAIAAAC9o5sfAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA7ElEQVQoz42PQUvDQBCF8/8v3r0UDyI9CF7qIWpTWhcTJIiJJIdgCd2FtTQbQ5pDstmZkTZUJKa032ku35v3rFSs7ZnL3NfZ/CVdCSLCA7Tn793DcqP04uruZnx7Obp+e/8gIgAgIlV+87VK+VdebOkIVo20NUQInUNETdM406lt24tn9vD4NJncO45jjBmQd70AABEO9RAxz/Pl5zLbbKSUnHMhxG90T+5zbOEJudOklGEYep6XJEkQBL7vM8Y45/9zBz4DgNZaKRXHcRRFZVniftlZtTvqui6KIsuyqqq01qdrD2KMadt2UP4B1twFEsoC1RwAAAAASUVORK5CYII=","srcSetWebp":"/static/4e613f33233ee0da0c64105105255fc0/61e93/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.webp 200w,\n/static/4e613f33233ee0da0c64105105255fc0/1f5c5/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.webp 400w,\n/static/4e613f33233ee0da0c64105105255fc0/58556/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.webp 800w,\n/static/4e613f33233ee0da0c64105105255fc0/e30b5/c734690e-db75-4ab6-bc74-ae1ed336964b_flutter_in_app_purchase-update.webp 1000w"},"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}}},"dimensions":{"width":1000,"height":466}},"author_name":{"text":"Alexander Thiele"},"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."},"meta_title":{"text":"in_app_purchase Plugin Update 2.0.0 - Whats new"}}}},"pageContext":{"id":"671cb936-5c89-5361-b99c-47a817b9444f","uid":"in_app_purchase-plugin-2-0-0-released","lang":"en-us","type":"flutter_post","url":"/flutter-blog/in_app_purchase-plugin-2-0-0-released/"}},
    "staticQueryHashes": []}