Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lykhonis/flutter_billing
Flutter plugin to enable billing on iOS and Android.
https://github.com/lykhonis/flutter_billing
dart dartlang flutter in-app-billing in-app-purchase
Last synced: 9 days ago
JSON representation
Flutter plugin to enable billing on iOS and Android.
- Host: GitHub
- URL: https://github.com/lykhonis/flutter_billing
- Owner: lykhonis
- License: apache-2.0
- Created: 2018-01-15T16:34:56.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-06T10:48:33.000Z (over 4 years ago)
- Last Synced: 2024-07-30T09:09:50.051Z (3 months ago)
- Topics: dart, dartlang, flutter, in-app-billing, in-app-purchase
- Language: Java
- Homepage:
- Size: 187 KB
- Stars: 94
- Watchers: 12
- Forks: 22
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## flutter_billing
A plugin for [Flutter](https://flutter.io) that enables communication with billing API in
[iOS](https://developer.apple.com/in-app-purchase/) and
[Android](https://developer.android.com/google/play/billing/billing_integrate.html).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](https://github.com/VolodymyrLykhonis/flutter_billing/issues) and
[Pull Requests](https://github.com/VolodymyrLykhonis/flutter_billing/pulls) are welcome.## Using
Add `flutter_billing` [![flutter_billing](https://img.shields.io/pub/v/flutter_billing.svg)](https://pub.dartlang.org/packages/flutter_billing) as a dependency in `pubspec.yaml`.Create an instance of the plugin:
```dart
final Billing billing = new Billing(onError: (e) {
// optionally handle exception
});
```Request available products for purchase:
```dart
final List products = await billing.getProducts([
'my.product.id',
'my.other.product.id',
]);
```
or
```dart
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):
```dart
final Set purchases = await billing.getPurchases();
```Check if a product is already purchased:
```dart
final bool purchased = purchases.contains('my.product.id');
```
or
```dart
final bool purchases = await billing.isPurchased('my.product.id');
```Purchase a product:
```dart
final bool purchased = await billing.purchase(productId);
```## 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