(Sun Rised!) Flutter plugin for In App Purchase.

Overview

flutter_inapp_purchase

Pub Version Build Status License Coverage Status

Flutter V2

This packages is compatible with flutter v2 from 4.0.0. For those who use older version please use < 4.0.0.

Sun Rise πŸŒ…

Since many one of you wanted me to keep working on this plugin in #93, I've decided to keep working on current project. I hope many one of you can help me maintain this. Thank you for all your supports in advance πŸŽ‰ .

## Deprecated I've been maintaining this plugin since there wasn't an official plugin out when I implemented it. I saw in flutter github issue #9591 that many people have been waiting for this plugin for more than a year before I've thought of building one. However, there has been an official Google plugin rised today which is in_app_purchase. Please try to use an official one because you might want to get much prompt support from giant Google. Also, thanks for all your supports that made me stubborn to work hard on this plugin. I've had great experience with all of you and hope we can meet someday with other projects. I'll leave this project as live for those who need time. I'll also try to merge the new PR's and publish to pub if there's any further work given to this repo.

What this plugin do

This is an In App Purchase plugin for flutter. This project has been forked from react-native-iap. We are trying to share same experience of in-app-purchase in flutter as in react-native. We will keep working on it as time goes by just like we did in react-native-iap.

PR is always welcomed.

Breaking Changes

  • Sunrise in 2.0.0 for highly requests from customers on discomfort in what's called an official plugin in_app_purchase.
  • Migrated to Android X in 0.9.0. Please check the Migration Guide.
  • There was parameter renaming in 0.5.0 to identify different parameters sent from the device. Please check the readme.

Migration Guide

To migrate to 0.9.0 you must migrate your Android app to Android X by following the Migrating to AndroidX Guide.

Getting Started

Follow the Medium Blog for the configuration.

Follow the Medium Blog to add subscriptions in app purchase.

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

Methods

Func Param Return Description
initConnection String Prepare IAP module. Must be called on Android before any other purchase flow methods. In ios, it will simply call canMakePayments method and return value.
getProducts List<String> Product IDs/skus List<IAPItem> Get a list of products (consumable and non-consumable items, but not subscriptions). Note: On iOS versions earlier than 11.2 this method will return subscriptions if they are included in your list of SKUs. This is because we cannot differentiate between IAP products and subscriptions prior to 11.2.
getSubscriptions List<String> Subscription IDs/skus List<IAPItem> Get a list of subscriptions. Note: On iOS this method has the same output as getProducts. Because iOS does not differentiate between IAP products and subscriptions.
getPurchaseHistory List<IAPItem> Gets an invetory of purchases made by the user regardless of consumption status (where possible)
getAvailablePurchases List<PurchasedItem> (aka restore purchase) Get all purchases made by the user (either non-consumable, or haven't been consumed yet)
getAppStoreInitiatedProducts List<IAPItem> If the user has initiated a purchase directly on the App Store, the products that the user is attempting to purchase will be returned here. (iOS only) Note: On iOS versions earlier than 11.0 this method will always return an empty list, as the functionality was introduced in v11.0. See Apple Docs for more info Always returns an empty list on Android.
requestSubscription String sku, String oldSkuAndroid?, int prorationModeAndroid?, String obfuscatedAccountIdAndroid?, String obfuscatedProfileIdAndroid?, String purchaseTokenAndroid? Null Create (request) a subscription to a sku. For upgrading/downgrading subscription on Android pass second parameter with current subscription ID, on iOS this is handled automatically by store. purchaseUpdatedListener will receive the result.
requestPurchase String sku, String obfuscatedAccountIdAndroid?, String obfuscatedProfileIdAndroid?, String purchaseToken? Null Request a purchase. purchaseUpdatedListener will receive the result.
finishTransactionIOS String purchaseTokenAndroid PurchaseResult Send finishTransaction call to Apple IAP server. Call this function after receipt validation process
acknowledgePurchaseAndroid String purchaseToken PurchaseResult Acknowledge a product (on Android) for non-consumable and subscription purchase. No-op on iOS.
consumePurchaseAndroid String purchaseToken PurchaseResult Consume a product (on Android) for consumable purchase. No-op on iOS.
finishTransaction String purchaseToken, bool isConsumable? } PurchaseResult Send finishTransaction call that abstracts all acknowledgePurchaseAndroid, finishTransactionIOS, consumePurchaseAndroid methods.
endConnection String End billing connection.
consumeAllItems String Manually consume all items in android. Do NOT call if you have any non-consumables (one time purchase items). No-op on iOS.
validateReceiptIos Map<String,String> receiptBody, bool isTest http.Response Validate receipt for ios.
validateReceiptAndroid String packageName, String productId, String productToken, String accessToken, bool isSubscription http.Response Validate receipt for android.

Purchase flow in `[email protected]+

purchase-flow-sequence

When you've successfully received result from purchaseUpdated listener, you'll have to verify the purchase either by acknowledgePurchaseAndroid, consumePurchaseAndroid, finishTransactionIOS depending on the purchase types or platforms. You'll have to use consumePurchaseAndroid for consumable products and android and acknowledgePurchaseAndroid for non-consumable products either subscription. For ios, there is no differences in verifying purchases. You can just call finishTransaction. If you do not verify the purchase, it will be refunded within 3 days to users. We recommend you to verifyReceipt first before actually finishing transaction. Lastly, if you want to abstract three different methods into one, consider using finishTransaction method.

Data Types

  • IAPItem

    final String productId;
    final String price;
    final String currency;
    final String localizedPrice;
    final String title;
    final String description;
    final String introductoryPrice;
    
    /// ios only
    final String subscriptionPeriodNumberIOS;
    final String subscriptionPeriodUnitIOS;
    final String introductoryPricePaymentModeIOS;
    final String introductoryPriceNumberOfPeriodsIOS;
    final String introductoryPriceSubscriptionPeriodIOS;
    
    /// android only
    final String subscriptionPeriodAndroid;
    final String introductoryPriceCyclesAndroid;
    final String introductoryPricePeriodAndroid;
    final String freeTrialPeriodAndroid;
    final String signatureAndroid;
    
    final String iconUrl;
    final String originalJson;
    final String originalPrice;
  • PurchasedItem

    final String productId;
    final String transactionId;
    final DateTime transactionDate;
    final String transactionReceipt;
    final String purchaseToken;
    final String orderId;
    
    // Android only
    final String dataAndroid;
    final String signatureAndroid;
    final bool autoRenewingAndroid;
    final bool isAcknowledgedAndroid;
    final int purchaseStateAndroid;
    final String originalJsonAndroid;
    
    // iOS only
    final DateTime originalTransactionDateIOS;
    final String originalTransactionIdentifierIOS;

Install

Add flutter_inapp_purchase as a dependency in pubspec.yaml

For help on adding as a dependency, view the documentation.

Configuring in app purchase

Usage Guide

Android connect and endConnection

  • You should start the billing service in android to use its funtionalities. We recommend you to use initConnection getter method in initState(). Note that this step is necessary in ios also from [email protected]+ which will also register the purchaseUpdated and purchaseError Stream.

      /// start connection for android
      @override
      void initState() {
        super.initState();
        asyncInitState(); // async is not allowed on initState() directly
      }
    
      void asyncInitState() async {
        await FlutterInappPurchase.instance.initConnection;
      }
  • You should end the billing service in android when you are done with it. Otherwise it will be keep running in background. We recommend to use this feature in dispose().

  • Additionally, we've added connectionUpdated stream just in case if you'd like to monitor the connection more thoroughly form 2.0.1.

    _conectionSubscription = FlutterInappPurchase.connectionUpdated.listen((connected) {
      print('connected: $connected');
    });
    

    You can see how you can use this in detail in example project.

      /// start connection for android
      @override
      void dispose() async{
        super.dispose();
        await FlutterInappPurchase.instance.endConnection;
      }

Get IAP items

void getItems () async {
  List<IAPItem> items = await FlutterInappPurchase.instance.getProducts(_productLists);
  for (var item in items) {
    print('${item.toString()}');
    this._items.add(item);
  }
}

Purchase Item

void purchase() {
  FlutterInappPurchase.instance.requestPurchase(item.productId);
}

Register listeners to receive purchase

StreamSubscription _purchaseUpdatedSubscription = FlutterInappPurchase.purchaseUpdated.listen((productItem) {
  print('purchase-updated: $productItem');
});

StreamSubscription _purchaseErrorSubscription = FlutterInappPurchase.purchaseError.listen((purchaseError) {
  print('purchase-error: $purchaseError');
});

Remove listeners when ending connection

_purchaseUpdatedSubscription.cancel();
_purchaseUpdatedSubscription = null;
_purchaseErrorSubscription.cancel();
_purchaseErrorSubscription = null;

Receipt validation

From 0.7.1, we support receipt validation. For Android, you need separate json file from the service account to get the access_token from google-apis, therefore it is impossible to implement serverless. You should have your own backend and get access_token. With access_token you can simply call validateReceiptAndroid method we implemented. Further reading is here. Currently, serverless receipt validation is possible using validateReceiptIos method. The first parameter, you should pass transactionReceipt which returns after requestPurchase. The second parameter, you should pass whether this is test environment. If true, it will request to sandbox and false it will request to production.

validateReceipt() async {
  var receiptBody = {
    'receipt-data': purchased.transactionReceipt,
    'password': '******'
  };
  const result = await validateReceiptIos(receiptBody, false);
  console.log(result);
}

For further information, please refer to guide.

App Store initiated purchases

When the user starts an in-app purchase in the App Store, the transaction continues in your app, the product will then be added to a list that you can access through the method getAppStoreInitiatedProducts. This means you can decide how and when to continue the transaction. To continue the transaction simple use the standard purchase flow from this plugin.

void checkForAppStoreInitiatedProducts() async {
  List<IAPItem> appStoreProducts = await FlutterInappPurchase.getAppStoreInitiatedProducts(); // Get list of products
  if (appStoreProducts.length > 0) {
    _requestPurchase(appStoreProducts.last); // Buy last product in the list
  }
}

Example

Direct to example readme which is just a cp from example project. You can test this in real example project.

ProGuard

If you have enabled proguard you will need to add the following rules to your proguard-rules.pro

#In app Purchase
-keep class com.amazon.** {*;}
-keep class com.dooboolab.** { *; }
-keep class com.android.vending.billing.**
-dontwarn com.amazon.**
-keepattributes *Annotation*

Q & A

Can I buy product right away skipping fetching products if I already know productId?

  • You can in Android but not in ios. In ios you should always fetchProducts first. You can see more info here.

How do I validate receipt in ios?

  • Official doc is here.

How do I validate receipt in android?

  • Offical doc is here.
  • I've developed this feature for other developers to contribute easily who are aware of these things. The doc says you can also get the accessToken via play console without any of your backend server. You can get this by following process.
    • Select your app > Services & APIs > "YOUR LICENSE KEY FOR THIS APPLICATION Base64-encoded RSA public key to include in your binary". reference.

Invalid productId in ios.

  • Please try below and make sure you've done belows.
    • Steps
      1. Completed an effective "Agreements, Tax, and Banking."
      2. Setup sandbox testing account in "Users and Roles."
      3. Signed into iOS device with sandbox account.
      4. Set up three In-App Purchases with the following status: i. Ready to Submit ii. Missing Metadata iii. Waiting for Review
      5. Enable "In-App Purchase" in Xcode "Capabilities" and in Apple Developer -> "App ID" setting. Delete app / Restart device / Quit "store" related processes in Activity Monitor / Xcode Development Provisioning Profile -> Clean -> Build.

Help Maintenance

I've been maintaining quite many repos these days and burning out slowly. If you could help me cheer up, buying me a cup of coffee will make my life really happy and get much energy out of it.

Paypal Buy Me A Coffee

Comments
  • Fatal Exception: java.lang.IllegalStateException: Reply already submitted

    Fatal Exception: java.lang.IllegalStateException: Reply already submitted

    I got the error from Firebase Crashlytics. Are there any insights into this? Is this related to #336 @mgonzalezc ?

    Fatal Exception: java.lang.IllegalStateException: Reply already submitted
           at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:35)
           at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:14)
           at com.dooboolab.flutterinapppurchase.MethodResultWrapper$1.run(MethodResultWrapper.java:8)
           at android.os.Handler.handleCallback(Handler.java:873)
           at android.os.Handler.dispatchMessage(Handler.java:99)
           at android.os.Looper.loop(Looper.java:214)
           at android.app.ActivityThread.main(ActivityThread.java:6990)
           at java.lang.reflect.Method.invoke(Method.java)
           at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
    

    Crash on: Android 9, Galaxy Note9 (real device)

    • flutter_inapp_purchase: ^5.1.2
    • flutter stable channel: 2.5.3
    • Android build-tools 31.0.0
    opened by offline-first 35
  • GetProducts return nil object error

    GetProducts return nil object error

    Version of flutter_inapp_purchase

    0.6.5

    Platforms you faced the error (IOS or Android or both?)

    IOS

    Expected behavior

    Getting the products

    Actual behavior

    Crashes as soon get products are called works on other devices and emulators

    Tested environment (Emulator? Real Device?)

    Ipad IOS version 9.3.5

    Steps to reproduce the behavior

    Calling getProducts crashes app and returns the following message:

    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[8]' *** First throw call stack: (0x2127b91b 0x20a16e17 0x21195443 0x211952c7 0x20978a1 0x211a1625 0x2119a251 0x20970c7 0x2abb75e7 0x20de9823 0x20de980f 0x20df7ba9 0x2123db6d 0x2123c067 0x2118b229 0x2118b015 0x2277bac9 0x2585f189 0x5bd49 0x20e33873)

    bug good first issue ios 
    opened by RobertBrunhage 31
  • Crash in Google Console

    Crash in Google Console

    Version of flutter_inapp_purchase

    0.5.4

    Platforms you faced the error (IOS or Android or both?)

    Android

    Actual behavior

    I've noticed crash in Google Play console. Crash log:

     java.lang.IllegalStateException:  
      at io.flutter.view.FlutterNativeView$1.reply (FlutterNativeView.java:48) 
      at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success (MethodChannel.java:14) 
      at com.dooboolab.flutterinapppurchase.FlutterInappPurchasePlugin$2.a (FlutterInappPurchasePlugin.java:6) 
      at com.android.billingclient.api.BillingClientImpl$BillingServiceConnection.onServiceConnected (BillingClientImpl.java:93) 
      at android.app.LoadedApk$ServiceDispatcher.doConnected (LoadedApk.java:1818) 
      at android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:1847) 
      at android.os.Handler.handleCallback (Handler.java:808) 
      at android.os.Handler.dispatchMessage (Handler.java:101) 
      at android.os.Looper.loop (Looper.java:166) 
      at android.app.ActivityThread.main (ActivityThread.java:7425) 
      at java.lang.reflect.Method.invoke (Method.java) 
      at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:245) 
      at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:921)
    

    Code to init billilng:

    Future<void> _billing_init() async
      {   
    
        try {
          _billing_prepare_result = await FlutterInappPurchase.prepare;
          print('result: '+_billing_prepare_result.toString());
    
          if (!mounted) return;
        }
        catch(e) {
          debugPrint('billing not available: '+e.toString());
        }
    
    
      }
    
     @override
      void initState() {
        super.initState();
    
        _billing_init();
    
      }
    
      @override
      void dispose() async{
        super.dispose();
    
        try {
          await FlutterInappPurchase.endConnection;
        }
        catch(e) {
        }
    
      }
    
    

    Device: Huawei P10 (HWVTR), Android 8.0

    Can not reproduce myself, any ideas how to debug?

    help wanted android 
    opened by opensourcegps 27
  • java.lang.IllegalStateException upon ending billing connection.

    java.lang.IllegalStateException upon ending billing connection.

    Version of flutter_inapp_purchase : 2.0.0+12

    Problem faced on a Android device - Vivo 1818

    Hi @hyochan once again!

    Today, I got a crash report from my play console the stack trace is shown below.

    java.lang.IllegalStateException: 
      at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply (DartMessenger.java:35)
      at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error (MethodChannel.java:14)
      at com.dooboolab.flutterinapppurchase.AndroidInappPurchasePlugin$1.onBillingServiceDisconnected (AndroidInappPurchasePlugin.java:10)
      at com.android.billingclient.api.BillingClientImpl$BillingServiceConnection.onServiceDisconnected (BillingClientImpl.java:28)
      at android.app.LoadedApk$ServiceDispatcher.doDeath (LoadedApk.java:1789)
      at android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:1804)
      at android.os.Handler.handleCallback (Handler.java:873)
      at android.os.Handler.dispatchMessage (Handler.java:99)
      at android.os.Looper.loop (Looper.java:224)
      at android.app.ActivityThread.main (ActivityThread.java:7157)
      at java.lang.reflect.Method.invoke (Method.java)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:537)
      at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:876)
    

    My guess is that, this might have occured when the plugin called upon end connection of billing services.

    Is this stacktrace of any help for making the plugin more stable. Thanks in advance!

    help wanted android 
    opened by dipinarora9 23
  • App crashes on initialisation when I release appbundle

    App crashes on initialisation when I release appbundle

    Version of flutter_inapp_purchase

    0.9.2

    Platforms you faced the error (IOS or Android or both?)

    Android

    I initialise billing as in the example and if I run the app on my device/emulator everything works fine. As soon as I release the app using appbundle I get crash on initialisation. If I build and release apk everything works fine. Is anyone facing the same issue?

    help wanted android 
    opened by savjolovs 22
  • Date Subscription Renew

    Date Subscription Renew

    Is there any way to get the date the subscription will renew after you bought it? I can see a TransactionDate but not when it will renew.

    Would like to see a PurchasedItem.renewDate or something similar.

    Or is it something I am missing?

    enhancement help wanted 
    opened by RobertBrunhage 21
  • i haven't pay sheet after call requestSubscription in IOS

    i haven't pay sheet after call requestSubscription in IOS

    i am using from flutter_inapp_purchase for auto renewal Subscription and when i call requestSubscription in my code i haven't pay sheet but received a callback on _purchaseUpdatedSubscription with received a old expired item.

    note: in first payment i have pay sheet and buy processes is successfully and when auto renewal period(6 auto renewal) is finished i try to buy in second i have this issue

      Future<Null> buyProduct() async {
        try {
          IAPItem item = _products.first;
          await FlutterInappPurchase.instance.requestSubscription(item.productId);
        } catch (error) {
          print("error on buyProduct: $error");
        }
      }
    
          _purchaseUpdatedSubscription =
            FlutterInappPurchase.purchaseUpdated.listen((productItem) async {
          print('purchase-updated: $productItem');
    
        });
    

    i use flutter_inapp_purchase ^3.0.1 version and my Platforms is IOS and I Tested on Real Device

    no-issue-activity 
    opened by mraslamiii 19
  • Purchasing Auto-Renewing Subscriptions Fails (Unknown Error)

    Purchasing Auto-Renewing Subscriptions Fails (Unknown Error)

    Version of flutter_inapp_purchase

    0.8.5

    Platforms you faced the error (IOS or Android or both?)

    iOS

    Expected behavior

    Purchase of auto-renewing subscription would work.

    Actual behavior

    Fetching of the products works as expected, however, when I call buyProduct on the item (an auto-renewing subscription), the transaction fails and the error message is: "An unknown or unexpected error has occurred. Please try again later." Tried to debug in XCode and can only see that the transaction state goes from purchasing to failed. I've checked that in app purchases are enabled in capabilities in the XCode project, all the products are set up appropriately in AppStoreConnect, and canMakePurchases returns true every time. Curious if anyone has run into this issue and what was done to mitigate. Thanks!

    Tested environment (Emulator? Real Device?)

    Real device

    help wanted ios 
    opened by kikiho 19
  • ios problem

    ios problem

    Version of flutter_inapp_purchase 2.1.4

    Platforms you faced the error (IOS or Android or both?) ios

    Expected behavior

    Actual behavior

    Tested environment (Emulator? Real Device?) real devince

    Steps to reproduce the behavior

    purchase-error: responseCode: null, debugMessage: SKPaymentTransactionStateFailed, code: E_UNKNOWN, message: An unknown or unexpected error has occured. Please try again later.

    help wanted ios no-issue-activity 
    opened by hsnbsst 17
  • FlutterInappPurchase.instance.acknowledgePurchaseAndroid(purchaseToken) is not working

    FlutterInappPurchase.instance.acknowledgePurchaseAndroid(purchaseToken) is not working

    Version flutter_inapp_purchase: ^2.0.0+8

    Problem faced in Android

    Expected behavior

    When called it should have returned me the purchase result with the state that my consumable product has now been acknowledged

    Actual behavior

    Payment is successful but this acknowledgement function is returning nothing and being a future function it is stuck at waiting stage.

    I am testing it on a real device.

    Steps to reproduce the behaviour

    
    {
    ...
    ..
    // Update this variable within initPlatformState()
     _purchaseUpdatedSubscription =
            FlutterInappPurchase.purchaseUpdated.listen((productItem) {
          print('purchase-updated: $productItem');
          validate(productItem);
        });
    }
    
    // Add this function
    validate(PurchasedItem item) async {
        debugPrint('Reaching Here');
        String s = await FlutterInappPurchase.instance
            .acknowledgePurchaseAndroid(item.purchaseToken);  // Output Stuck here
        debugPrint('Acknowledgement Result - $s');
      }
    
    
    help wanted android 
    opened by dipinarora9 16
  • getSubscriptions unhandled exception (trying to save a String to List)

    getSubscriptions unhandled exception (trying to save a String to List)

    Just upgraded to v0.5.8 and get this error on FlutterInappPurchase.getSubscriptions(skus); under iOS. Was working perfectly on v0.4.0.

    It appears that

    result = json.encode(result);
    
    result = json.encode(result);
    List list = json.decode(result.toString()); // this
    

    Is returning a string.

    [VERBOSE-2:dart_error.cc(16)] Unhandled exception:
    type 'String' is not a subtype of type 'List<dynamic>'
    #0      FlutterInappPurchase.getSubscriptions (package:flutter_inapp_purchase/flutter_inapp_purchase.dart:113:24)
    <asynchronous suspension>
    #1      Store.getProducts (package:when_coin/services/store.dart:16:48)
    <asynchronous suspension>
    #2      _TestPageState._getProducts (package:when_coin/screens/store/store.dart:10:36)
    #3      _TestPageState.build.<anonymous closure> (package:when_coin/screens/store/store.dart:22:30)
    #4      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
    #5      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
    #6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
    #7      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
    #8      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
    #9      PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
    #10     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
    #11     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
    #12     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
    #13     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
    #14     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
    #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
    #16     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
    #17     _invoke1 (dart:ui/hooks.dart:134:13)
    #18     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
    
    
    bug ios 
    opened by lukepighetti 16
  • PlatformException(getSubscriptions, E_NOT_PREPARED, IAP not prepared. Check if Google Play service is available., null)

    PlatformException(getSubscriptions, E_NOT_PREPARED, IAP not prepared. Check if Google Play service is available., null)

    When trying to run the getSubscriptions, I got this error final List _productIds = [ 'plus_sub', 'plus_diamond', 'plus_subscription_android', 'diamond_subscription_android', ]; FlutterInappPurchase.instance.getSubscriptions(_productIds);

    How to fix this error?

    opened by goddev999 0
  • Access to Amazon userId is critical to verify subscription receipts

    Access to Amazon userId is critical to verify subscription receipts

    flutter_inapp_purchase : 5.3.1 Platforms you faced the error (IOS or Android or both?) Android -> Amazon Expected behavior: a way to access to platform userId for Amazon Actual behavior: The user id value is not being used Tested environment (Emulator? Real Device?) Real Device Steps to reproduce the behavior Purchase a subscription via the Amazon IAP Sandbox or the Amazon sdk tester

    In order to verify an amazon receipt, the app needs to know the userId value. The userId value is returned in the callback PurchasingListener::onPurchaseResponse(PurchaseResponse). However it is not a place to access in the response. Also, the data could be made available via the initConnection call. However, the call logs the data, but does not provide an access to it.

    May Ask: Can you provide an FIPActiveEnvironment Object with platform specific methods (e.g. appStoreData, playStoreData, amazonStoreData) for data unique to that platform.

    opened by JoyHong 0
  • requestPurchase() is not opening up iOS payment dialog

    requestPurchase() is not opening up iOS payment dialog

    Version of flutter_inapp_purchase

    I'm using flutter_inapp_purchase: ^5.3.1

    Platforms you faced the error (IOS or Android or both?)

    Facing this issue only on iOS

    Expected behaviour

    When I call FlutterInappPurchase.instance.requestPurchase(productId);, iOS device should Log Purchase Started ! ! and bring up the App store's Purchase Dialog.

    Actual behaviour

    Sometimes it does bring up the Dialog, But many times, It logs Restored and does nothing. This log is coming from the iOS part of the Plugin i.e., FlutterInAppPurchase.m.

    Tested environment (Emulator? Real Device?)

    I tested this on Real devices, iPhone 13 and iPhone 12

    Steps to reproduce the behaviour

    When the app opens, I call isReady(), getSubscriptions(skus), and getAvailablePurchases() in this order and with an await. By the time user goes to the Subscription page, all these will be loaded. And when User clicks on the Product, I'm calling requestPurchase(productId). It is after I call requestPurchase(), I either see Purchase Started ! ! log which is how it should be. But many times I just see Restored. I have confirmed that There's no active Subscription. This happens with both the Sandbox account and in Testflight.

    opened by KamathVishak96 3
  • getPurchaseHistory() and getAvailablePurchases() are not resolved / rejected

    getPurchaseHistory() and getAvailablePurchases() are not resolved / rejected

    Version of flutter_inapp_purchase

    5.3.1

    Platforms you faced the error (IOS or Android or both?)

    both

    Expected behavior

    request should be resolved/rejected

    Actual behavior

    request not being resolved/rejected

    Tested environment (Emulator? Real Device?)

    Emulator and Real Device

    Steps to reproduce the behavior

    final history = await _iap.getPurchaseHistory(); final purchases = await _iap.getAvailablePurchases();

    Similar issue

    I think it is same issue as in React native this

    opened by GuvanchBayryyyev 4
  • Getting

    Getting "IAP not prepared" error on both emulator and real device

    Version of flutter_inapp_purchase

    5.3.1

    Platforms you faced the error (IOS or Android or both?)

    Android

    Expected behavior

    To open Google Pay menu

    Actual behavior

    Gives error:

    PlatformException(buyItemByType, E_NOT_PREPARED, IAP not prepared. Check if Google Play service is available., null)

    Tested environment (Emulator? Real Device?)

    Both Emulator: Android 12 with Google Play Services enabled Phone: Android 12 with Google Play Services enabled

    opened by harundemir918 0
Releases(5.3.0)
  • 5.3.0(Jun 4, 2022)

    What's Changed

    • Refactor java to kotlin, add showInAppMessageAndroid by @offline-first in https://github.com/dooboolab/flutter_inapp_purchase/pull/365

    New Contributors

    • @offline-first made their first contribution in https://github.com/dooboolab/flutter_inapp_purchase/pull/365

    Full Changelog: https://github.com/dooboolab/flutter_inapp_purchase/compare/5.2.0...5.3.0

    Source code(tar.gz)
    Source code(zip)
  • 5.2.0(May 16, 2022)

    5.2.0

    Bugfix #356

    5.1.1

    Run on UiThread and few others (#328)

    • Related #272

    • The main difference is a new MethodResultWrapper class that wraps both the result and the channel. onMethodCall() now immediately saves this wrapped result-channel to a field and only uses that later to set both the result and to send back info on the channel. I did this in both Google and Amazon but I can't test the Amazon one.

    • Included the plugin registration differences.

    • Midified suggested in one of the issues that initConnection, endConnection and consumeAllItems shouldn't be accessors. This is very much so, property accessors are not supposed to do work and have side effects, just return a value. Now three new functions are suggested and marked the old ones deprecated.

    Fourth, EnumUtil.getValueString() is not really necessary, we have describeEnum() in the Flutter engine just for this purpose.

    Source code(tar.gz)
    Source code(zip)
  • 5.1.0(Nov 14, 2021)

    5.1.0

    Upgrade android billing client to 4.0.0 (#326)

    Remove orderId in Purchase

    • This is duplicate of transactionId.

    Support for Amazon devices with Google Play sideloaded (#313)

    5.0.4

    • Add iOS promo codes (#325)
    • Use http client in validateReceiptIos (#322)
    • Amazon getPrice directly withoiut formatting (#316)

    5.0.3

    • Fix plugin exception for requestProductWithQuantityIOS #306

    5.0.2

    • Replaced obfuscatedAccountIdAndroid with obfuscatedAccountId in request purchase method #299

    5.0.1

    • Add AndroidProrationMode values #273

    5.0.0

    • Support null safety #275

    4.0.2

    • The dart side requires "introductoryPriceCyclesAndroid" to be a int #268

    4.0.1

    • platform dep version >=2.0.0 <4.0.0

    4.0.0

    • Support flutter v2 #265

    3.0.1

    • Migrate to flutter embedding v2 #240
    • Expose android purchase state as enum #243
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Nov 29, 2020)

    • Upgrade android billing client to 2.1.0 from 3.0.0.
    • Removed deveoperId and accountId when requesting purchase or subscription in android.
    • Added obfuscatedAccountIdAndroid and obfuscatedProfileIdAndroid when requesting purchase or subscription in android.
    • Removed developerPayload in android.
    • Added purchaseTokenAndroid as an optional parameter to requestPurchase and requestSubscription.
    Source code(tar.gz)
    Source code(zip)
  • 2.3.2(Oct 15, 2020)

    2.3.2

    • Add missing dep 'meta'.

    2.3.1

    Republishing since sourcode seems not merged correctly.

    2.3.0

    • Bugfix IAPItem deserialization #212
    • Add introductoryPriceNumberIOS #214
    • Fix iOS promotional offers #220

    2.2.0

    • Implement endConnection method to declaratively finish observer in iOS.
    • Remove addTransactionObserver in IAPPromotionObserver.m for dup observer problems.
    • Automatically startPromotionObserver in initConnection for iOS.

    2.1.5

    • Fix ios failed purchase handling problem in 11.4+ #176

    2.1.4

    • Fix dart side expression warning #169.

    2.1.3

    • Fix wrong introductory price number of periods #164.

    2.1.2

    • Trigger purchaseUpdated callback when iap purchased #165.

    2.1.1

    • Renamed finishTransactionIOS argument purchaseToken to transactionId.

    2.1.0

    • finishTransaction parameter changes to purchasedItem from purchaseToken.
    • Update android billing client to 2.1.0 from 2.0.3.

    2.0.5

    • [bugfix] Fix double call of result reply on connection init #126

    2.0.4

    • [bugfix] Fix plugin throws exceptions with flutter v1.10.7 beta #117

    2.0.3

    • [bugfix] Decode response code for connection updates stream #114
    • [bugfix] Fix typo in consumePurchase #115

    2.0.2

    • use ConnectionResult as type for connection stream, fix controller creation #112

    2.0.0+16

    • Resolve #106 by not sending result.error to the listener. Created use _conectionSubscription.

    2.0.0+15

    • Fixed minor typo when generating string with toString. Resolve #110.

    2.0.0+14

    • Pass android exception to flutter side.

    2.0.0+13

    • Android receipt validation api upgrade to v3.

    2.0.0+12

    • Resolve #102. Fluter seems to only sends strings between platforms.

    2.0.0+9

    2.0.0+8

    2.0.0+7

    2.0.0+6

    • Send purchase-error with purchases returns null.

    2.0.0+5

    • Renamed invoked parameters non-platform specific.

    2.0.0+4

    • Add deveoperId and accountId when requesting purchase or subscription in android. Find out more in requestPurchase and requestSubscription.

    2.0.0+3

    • Correctly mock invoke method and return results #94

    2.0.0+2

    • Seperate long example code to example readme.

    2.0.0+1

    • Properly set return type PurchaseResult of when finishing transaction.

    2.0.0 :tada:

    • Removed deprecated note in the readme.
    • Make the previous tests work in travis.
    • Documentation on readme for breaking features.
    • Abstracts finishTransaction.
      • acknowledgePurchaseAndroid, consumePurchaseAndroid, finishTransactionIOS.

    [Android]

    • Completely remove prepare.
    • Upgrade billingclient to 2.0.3 which is currently recent in Sep 15 2019.
    • Remove [IInAppBillingService] binding since billingClient has its own functionalities.
    • Add [DoobooUtils] and add getBillingResponseData that visualizes erorr codes better.
    • buyProduct no more return asyn result. It rather relies on the purchaseUpdatedListener.
    • Add feature method acknowledgePurchaseAndroid
      • Implement acknowledgePurchaseAndroid.
      • Renamed consumePurchase to consumePurchaseAndroid in dart side.
      • Update test codes.
    • Renamed methods
      • buyProduct to requestPurchase.
      • buySubscription to requestSubscription.

    [iOS]

    • Implment features in new releases.
      • enforce to finishTransaction after purchases.
      • Work with purchaseUpdated and purchaseError listener as in android.
      • Feature set from react-native-iap v3.
      • Should call finish transaction in every purchase request.
      • Add IAPPromotionObserver cocoa touch file
      • Convert dic to json string before invoking purchase-updated
      • Add getPromotedProductIOS and requestPromotedProductIOS methods
      • Implement clearTransaction for ios
      • Include purchasePromoted stream that listens to iap-promoted-product.

    1.0.0

    0.9.+

    • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate to Android X if they're using the original support library. Android's Migrating to Android X Guide.
    • Improved getPurchaseHistory's speed 44% faster #68.

    0.8.+

    • Fixed receipt validation param for android.
    • Updated http package.
    • Implemented new method getAppStoreInitiatedProducts.
      • Handling of iOS method paymentQueue:shouldAddStorePayment:forProduct:
      • Has no effect on Android.
    • Fixed issue with method buyProductWithoutFinishTransaction for iOS, was not getting the productId.
    • Fixed issue with toString method of class IAPItem, was printing incorrect values.
    • Fixes for #44. Unsafe getting originalJson when restoring item and Android.
    • Use dictionaryWithObjectsAndKeys in NSDictionary to fetch product values. This will prevent from NSInvalidArgumentException in ios which rarely occurs.
    • Fixed wrong npe in android when getAvailablePurchases.
    • Only parse orderId when exists in Android to prevent crashing.
    • Add additional success purchase listener in iOS. Related #54
    Source code(tar.gz)
    Source code(zip)
  • 0.7.1(Oct 4, 2018)

  • 0.6.6(Sep 13, 2018)

Owner
dooboolab
Open Source Community. Slack: https://dooboolab.com/joinSlack
dooboolab
Admob Flutter plugin that shows banner ads using native platform views.

admob_flutter A Flutter plugin that uses native platform views to show Admob banner ads! This plugin also has support for Interstitial and Reward ads.

Kevin McGill 416 Nov 14, 2022
A Flutter plugin to fetch system messages, stacktraces etc.

logcat Flutter plugin to get system messages, stack traces etc and show them in app. Can also be used to get the app logs from a remote device with sh

null 4 Jul 25, 2021
Flutter Facebook Audience Network

facebook_audience_network Facebook Audience Network plugin for Flutter applications (Android & iOS). Banner Ad Native Banner Ad Native Ad Interstitial

Dreamsoft Innovations 148 Oct 1, 2022
A flutter application for attendance registration of students which has nodejs as backend server with mongoDb database.

attandanceregister A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you start

null 6 Jul 2, 2022
A Flutter app to show how to implement in-app purchase using the in-app-purchase package

Flutter in-app purchase A Flutter project to show to implement in-app purchase using the in_app_purchase package Simple UI but it's okay ?? ?? WhatsAp

AntΓ³nio Nicolau 5 Jul 26, 2022
iOS App to Record Daily Sun Intake

Why Suncheck 당신은 ν•˜λ£¨μ— ν•΄λ₯Ό μ–Όλ§ˆλ‚˜ λ³΄λ‚˜μš”? μ½”μ‹œκ΅­μ— λ”μš± μš°μšΈν•˜κ±°λ‚˜ 무기λ ₯ν•œ 건 햇살을 μΆ©λΆ„νžˆ 받지 λͺ»ν•΄μ„œ 일 μˆ˜λ„ μžˆμ–΄μš”. 맀일 단 15λΆ„μ˜ ν–‡μ‚΄λ§ŒμœΌλ‘œ 우리 λ‡Œμ—μ„œλŠ” μš°μšΈμ¦μ„ μ˜ˆλ°©ν•  수 μžˆμ„ 만큼의 μ„Έλ‘œν† λ‹Œμ΄ λΆ„λΉ„λ©λ‹ˆλ‹€. λ§Œμ•½ ν•˜λ£¨ λ™μ•ˆ λ‚΄κ°€ μ–Όλ§ˆλ‚˜

Sohee Kim 14 Oct 18, 2022
A day night time picker for Flutter. Beautiful day and night animation with Sun and Moon assets.

DayNightTimePicker A day night time picker for Flutter with Zero Dependencies. Default style: IOS style: View it on pub.dev Installation Add to pubspe

Subhamay Dutta 65 Oct 7, 2022
Customers To Purchase Furnitures Online Ecommerce App Built With Flutter

flutter_ecommerce_app Description This simple project is a mobile based application,which provides customers to purchase furnitures online. And it con

null 0 Nov 14, 2021
react-native native module for In App Purchase.

Documentation Published in website. Announcement Version 8.0.0 is currently in release candidate. The module is completely rewritten with Kotlin and S

dooboolab 2.2k Nov 22, 2022
Flutter ticket pass - A Flutter Widget to display the details of a ticket/pass purchased by customers and display the details of the purchase

ticket_pass_package A Flutter package to display the purchase of a ticket/pass along with additional details such as list of buyers. The source code i

null 40 Aug 13, 2022
Flutter Application to purchase movie tickets, search for a movie, view movie details and proceed to select seats and movie times.

Flutter Application to purchase movie tickets, search for a movie, view movie details and proceed to select seats and movie times.

Stanley Valenzuela 6 May 25, 2022
This is just the simplyfied Flutter Plugin use for one of the popular flutter plugin for social media login.

social_media_logins Flutter Plugin to login via Social Media Accounts. Available Social Media Logins: Facebook Google Apple Getting Started To use thi

Reymark Esponilla 3 Aug 24, 2022
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.

On most operating systems, permissions aren't just granted to apps at install time. Rather, developers have to ask the user for permissions while the

Baseflow 1.7k Nov 22, 2022
A Flutter example to use Google Maps in iOS and Android apps via the embedded Google Maps plugin Google Maps Plugin

maps_demo A Flutter example to use Google Maps in iOS and Android apps via the embedded Google Maps plugin Google Maps Plugin Getting Started Get an A

Gerry High 41 Feb 14, 2022
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.

Flutter permission_handler plugin The Flutter permission_handler plugin is build following the federated plugin architecture. A detailed explanation o

Baseflow 1.7k Nov 17, 2022
Unloc customizations of the Permission plugin for Flutter. This plugin provides an API to request and check permissions.

Flutter Permission handler Plugin A permissions plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check perm

Unloc 1 Nov 26, 2020
Klutter plugin makes it possible to write a Flutter plugin for both Android and iOS using Kotlin only.

The Klutter Framework makes it possible to write a Flutter plugin for both Android and iOS using Kotlin Multiplatform. Instead of writing platform spe

Gillian 31 Nov 11, 2022
A Flutter step_tracker plugin is collect information from user and display progress through a sequence of steps. this plugin also have privilege for fully customization from user side. like flipkart, amazon, myntra, meesho.

step_tracker plugin A Flutter step_tracker plugin is collect information from user and display progress through a sequence of steps. this plugin also

Roshan nahak 5 Oct 21, 2022
A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed apps.

Flutter AppAvailability Plugin A Flutter plugin that allows you to check if an app is installed/enabled, launch an app and get the list of installed a

Lorenzo Pichilli 88 Oct 6, 2022