How to implement In-App Purchases Subscription in Flutter?

David picture David · Dec 21, 2018 · Viewed 20.6k times · Source

I want to provide auto renewable subscription in my Flutter App for both iOS and Android devices. Users can subscribe for 1 Month.

There is not an officially maintained in-app purchase plugin yet. But there are lots of plugins about In-App Purchases in Flutter.

Which one is the best? How to implement? Are these secure?

Answer

awaik picture awaik · Apr 24, 2019

==== UPDATE from 11.03.2020

Hi, I can see this post still reading by people who looking for a method of how to work with subscription in Flutter. During 2019 I made two apps with thousands install where users can buy a renewable subscription on the 2 platforms. Until February 2020 I used for this package from Flutter team https://pub.dev/packages/in_app_purchase, BUT - there is no way to get info about the user to unsubscribe in iOS. This is not the plugin issue, but the iOS approach for the process. We should implement our own backend for security reasons (by the way Google also recommends to do the same, but still left the way to check the state directly from the app).

So, after some researches, I found guys who made backend and plugin and it is free until you have less than 10 000 USD revenue for the month. https://www.revenuecat.com/ https://pub.dev/packages/purchases_flutter

I've implemented this plugin in my apps and it works like a charm. There is some good approaches that allow you to get a subscription state at any point in the app. I'm going to make an example and article, but not sure about the timing.

==== UPDATE from 03.10.2019

I recommend using new package from Flutter team https://pub.dev/packages/in_app_purchase

The example with code is here https://github.com/flutter/plugins/tree/master/packages/in_app_purchase/in_app_purchase/example

With this plugin I successfully implemented payments and recursive subscriptions to Android and iOS simultaneously. With the old package I had some minor issues.

You can use nice plugin flutter_inapp_purchase

I've used it for the app that I developed and it works well. You can use my example of how to work with subscription - github There is a complete working example - when you run it, you should get the screen

enter image description here

(do not forget to log in to Google play in an emulator or you will get “in-app billing version 3 NOT supported”)