tree: 08dfbc73ae622eb5923a7696861a4186cad2442a [path history] [tgz]
  1. android/
  2. example/
  3. ios/
  4. lib/
  5. test/
  6. analysis_options.yaml
  7. build.yaml
  8. CHANGELOG.md
  9. in_app_purchase.iml
  10. in_app_purchase_android.iml
  11. LICENSE
  12. pubspec.yaml
  13. README.md
packages/in_app_purchase/README.md

In App Purchase

A Flutter plugin for in-app purchases.

Getting Started

This plugin is not ready to be used yet. Follow flutter/flutter#9591 for more updates.

There's a significant amount of setup required for testing in app purchases successfully, including registering new app IDs and store entries to use for testing in both the Play Developer Console and App Store Connect. Both Google Play and the App Store require developers to configure an app with in-app items for purchase to call their in-app-purchase APIs. You can check out the example app for an example on configuring both.

Development

This plugin uses json_serializable for the many data structs passed between the underlying platform layers and Dart. After editing any of the serialized data structs, rebuild the serializers by running flutter packages pub run build_runner run.

Design

The API surface is stacked into 2 main layers.

  1. in_app_purchase_connection.dart, the generic idiommatic Flutter API. This exposes the most basic IAP-related functionality. The goal is that Flutter apps should be able to use this API surface on its own for the vast majority of cases. google_play_connection.dart and app_store_connection.dart implement this for the specific platforms.

  2. The dart wrappers around the platform specific IAP APIs and their platform specific implementations of the generic interface. See store_kit_wrappers.dart and billing_client_wrappers.dart. These API surfaces should expose all the platform-specific behavior and allow for more fine-tuned control when needed.