Project Update
Overall, the project is on track, with some changes as I've seen the Web Monetization's ecosystem hasn't grown much. Hopefully, this changes in the future and more developers are attracted into it, good tooling is a necessity for it to happen and there are some very good ideas within.
Progress on objectives
This project's objective was to lower the barrier for developers to delve into Web Monetization and I think it improves the developer experience drastically, some last-minute changes were providing native support for experimental platforms such as Flutter Mobile and Flutter Desktop, this poses a significant structural shift as to how the library was designed but it can improve the developer experience and encourage experimentation. I'm still researching the best way to implement this without disrupting (too much!) the existing codebase and integrating it all together. To be able to support all platforms would be the ultimate goal, if possible now or in the future.
Key activities
Some recent changes were:
Revenue sharing was updated to use WebMonetization.org's API instead of the manual probabilistic approach.
I completely swapped a feature for another, manual probabilistic revenue sharing was a good idea at the time, but now we can just use one payment pointer leveraging WebMonetization.org's API which is a no-brainer, considering it works with the receipt verifier service.
Receipt verifier service was enabled by default using WebMonetization.org's API.
This is very important for premium content, once again having a public receipt verifier service is very useful as running your own is a difficult task and would be counterproductive for most users. Asking for the receipts is enabled for default but it can be disabled too.
Using both revenue sharing and the receipt verifier service together is supported now.
To sum up, Monetization for Dart has support for all examples in the docs:
β Exclusive content
β Remove ads
β Micropayment counter
β Probabilistic revenue sharing
β Start/stop monetization
β Receipt verifier service
KNawm / monetization
πΈ A wrapper around the Web Monetization API to monetize apps.
monetization
A wrapper around the Web Monetization API
Offer extra content and features for users who stream micro-payments β including premium features, additional content, or digital goods.
API Reference
Usage
A simple usage example that initializes the monetization to a specific payment pointer:
import 'package:monetization/monetization.dart';
main() {
var monetization = Monetization('\$pay.tomasarias.me');
}
You can subscribe to Web Monetization events using a Stream
:
monetization.onPending.listen((event) {
// Prepare to serve the monetized content
});
monetization.onStart.listen((event) {
// Show monetized content
});
monetization.onProgress.listen((event) {
// Do something on each micro-payment
});
monetization.onStop.listen((event) {
// Hide monetized content
});
You can also check if a user is paying without subscribing to the streams:
Future<bool> isPaying() async {
// Prefer custom logic over this
await Future.delayed(const Duration(seconds: 3))
β¦Whatβs next?
Support custom receipt verifier service.
Expand the test suite for more coverage.
Update documentation with examples and latest changes.
Publishing v2.0.0 on pub.dev.
Create sample applications for Flutter Mobile and Desktop.
Research compatibility and possible upgrades to Dart 2.13.
What community support would benefit your project?
Filing issues, bug reports, pull requests, or just lay some crazy idea you have is great! You can contribute in a lot of ways if you're interested in the project.
Top comments (0)