DEV Community

Cover image for Flutter in-app purchases setup
Hari Krishnan
Hari Krishnan

Posted on

Flutter in-app purchases setup

In app purchases are those which you make in any android or iOS store. It might be directly the app itself, or advanced features in the app or just game coins in case of a game app.

There are three main types of in-app purchases.

1. Consumables

Consumables are products that are depleted and they can be purchased multiple times. Simple example would be coins in a game.

2. Non-consumable

They are one time purchase from the app provider and it never needs to purchased again. Like a premium feature in some app you are using.

3. Subscription

This type gives the user access to the purchase for a given amount of time. Then after it expires you have to purchase it again or you can make recurring payments to the same.

Setup process has some differences for android and iOS.

Initial setup for iOS

  • For iOS you need to have an apple developer account

  • You need to have a release of your iOS app in AppStore connect. It doesn't need to be on the public app store, just on the app store connect for use with things like test flight. Refer

  • In app store connect, go to My Apps -> Your app -> Features (In-app purchases)

  • It will prompt for the in-app purchase type, for now you can try creating a consumable in-app purchase. Keep a note of the product id since this has to be the same in google play store also.

Image description

  • Check the availability check box to make the in app purchase available in the app store.

Image description

  • Under price schedule, you have to select the price category for the in app purchase. Feel free to select your own country and respective currency. Start date is the date when that specific price will take effect in the app store for that purchase.

Image description

  • Select the tax category in which your app lies, for example if your app is a game app, try selecting the Games category and for each purchase the actual tax for that category would be chargeable

  • After creating the in-app purchase, you have to open your project in XCode and enable the in-app purchases capability. Under signing and capabilities create the in app purchase capability

  • When you are again building, make sure you add the in app purchase capability to the provisioning profile you are using to sign your app

Initial setup for Android

  • For Android, you should be having a google play developer account. You also should have a signed release apk uploaded in google play. Refer

  • Once you create a singed apk, you will need to atleast create an alpha release for your app in google play. This will allow you to test the google play billing api locally in your test device

  • Google billing api won't work if you have not created a release for your app. You also want to add the email address of the tester of that app.

  • Go to Monetize -> Products -> In-app products. You will be prompted to set up a google play merchant's account. For that you need to create a payment profile which can be one of google cloud's billing account or you can create one.

  • So here you won't be prompted for the purchase type as it did in iOS. You have to handle the type of purchase from code.

  • While creating the unit in the play store, give the name, description, status to active, price and the same product id which you used in iOS while creating the in-app purchase.

Plugin for implementing in app purchase

Discussion (0)