A Flutter project to show to implement in-app purchase using the in_app_purchase package
Simple UI but it's okay 🥲😉
WhatsApp.Video.2022-07-24.at.11.04.51.PM.mp4
To getting start with this project please make sure to take those steps done:
-
Flutter 3.0.0 or higher installed
-
Have your app bundle sent to stores for production to activate in-app purchase, see here steps to release flutter apps
-
Create product and subscription on stores. we'll use product with ID
in.app.purchase.testeproduct
and subscriptionin.app.purchase.testesubscription
. See here how to do it for Android and IOS
We'll use in_app_purchase package. This plugin supports in-app purchases (IAP) through an underlying store, which can be the App Store (on iOS) or Google Play (on Android)
This project has examples of code for the following tasks:
-
Listening to purchase updates
-
Connecting to the underlying store
-
Loading products for sale
-
Restoring previous purchases
-
Making a purchase
-
Upgrading or downgrading an existing in-app subscription
-
Accessing platform specific product or purchase properties (for purchase validation purposes)
NOTE: Please remember to always verify purchase on backend side before delivery it to user. Did add code section where you can see how to extract those data to send to your own backend
NOTE: This project was written using riverpod as state management but you can apply the same logic for others of your preference, feel free to change 😏
If you notice an expected behavior or would like to have any feature related in-app purchase implemented, then feel free to report or contribute with your pull request