flutter_billing 0.4.0 copy "flutter_billing: ^0.4.0" to clipboard
flutter_billing: ^0.4.0 copied to clipboard

A flutter plugin to communicate with billing on iOS and Android.

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
});
copied to clipboard

Request available products for purchase:

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

or

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

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

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

Check if a product is already purchased:

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

or

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

Purchase a product:

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

Limitations #

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

  • One time purchase products are not supported
  • Consumable products are not supported
  • Android subscription are not supported
  • iOS receipt request is not supported
  • iOS subscriptions are not supported
0
likes
40
points
55
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.22 - 2025.04.06

A flutter plugin to communicate with billing on iOS and Android.

Repository (GitHub)

License

Apache-2.0 (license)

Dependencies

flutter, synchronized

More

Packages that depend on flutter_billing