Skip to content

zackLore/flutter_billing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flutter_billing

A plugin for Flutter that enables communication with billing API in iOS and Android.

This plugin implements in app purchases rather than Android Pay or Apple Pay. Both Apple and Google collect fees upon each successful transaction made using this plugin.

Warning: This plugin is still under development, some billing features are not available yet and testing has been limited. Feedback and Pull Requests are welcome.

Using

Add flutter_billing flutter_billing as a dependency in pubspec.yaml.

Create an instance of the plugin:

final Billing billing = new Billing(onError: (e) {
  // optionally handle exception
});

Request available products for purchase:

final List<BillingProduct> products = await billing.getProducts(<String>[
    'my.product.id',
    'my.other.product.id',
]);

or

final BillingProduct product = await billing.getProduct('my.product.id');
if (product != null) {
  // success
} else {
  // something went wrong
}

Request purchased products (each purchase is a product identifier):

final Set<String> purchases = await billing.getPurchases();

Check if a product is already purchased:

final bool purchased = purchases.contains('my.product.id');

or

final bool purchases = await billing.isPurchased('my.product.id');

Purchase a product:

final bool purchased = await billing.purchase(productId);

Limitations

This is just an initial version of the plugin. There are still some limitations:

  • Only non-consumable in app products are supported

About

Flutter plugin to enable billing on iOS and Android.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 42.1%
  • Objective-C 26.5%
  • Dart 24.5%
  • Ruby 5.8%
  • Swift 1.1%