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.
Add 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);
This is just an initial version of the plugin. There are still some limitations:
One time purchase products are not supportedConsumable products are not supportedAndroid subscription are not supportediOS receipt request is not supported- iOS subscriptions are not supported
flutter_billing's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.