0 purchases
flutter bazaar
SHOW PERSIAN README
flutter_bazaar #
CafeBazaar API (In-App Purchase, Intents, UpdateChecker, LoginChecker) in flutter, works only in Android platform
Getting Started #
first, add flutter_bazaar to your pubspec dependencies.
flutter_bazaar: <LAST VERSION>
copied to clipboard
To import flutter_bazaar:
import 'package:flutter_bazaar/flutter_bazaar.dart';
copied to clipboard
Done!
API #
In-App purchase
Initialization
Purchase a product
Subscribe to product
Consume a purchase
Disconnect
Intents
Open application detail page
Open Developer applications List
Open comment form
Open login page
Update Checker
Login Checker
In-App purchase #
InAppPurchase of this library build by Poolakey, new cafebazaar IAP library
Initialization #
first you must initialized iap :
final _bazaar = FlutterBazaar.instance;
final iap = _bazaar.inAppPurchase(PUBLIC_KEY);
copied to clipboard
PUBLIC_KEY is your public RSA key from cafebazaar control panel
Purchase a product #
final PurchaseInfo purchaseInfo = await iap.purchase("productId", payLoad: "Your payload");
if(purchaseInfo != null) {
print('success: $purchaseResult');
}
copied to clipboard
if purchaseInfo != null purchase is successful
purchaseInfo is full detail of purchase :
class PurchaseInfo {
final String orderId;
final String purchaseToken;
final String payload;
final String packageName;
final String purchaseState;
final int purchaseTime;
final String productId;
final String dataSignature;
}
copied to clipboard
Subscribe to product #
final PurchaseInfo purchaseInfo = await iap.subscribe("productId", payLoad: "Your payload");
if(purchaseInfo != null) {
print('success: $subscribeResult');
}
copied to clipboard
if purchaseInfo != null subscription is successful
Consume a purchase #
final bool consumeResult = await iap.consume("PURCHASE TOKEN"); //IN PurchaseInfo.purchaseToken
copied to clipboard
note: if you need PurchaseToken after purchase you can getting it from purchaseInfo.purchaseToken
User purchases #
for getting all purchases of user :
final List<PurchaseInfo> purchasedProducts = await iap.getPurchasedProducts();
print(purchasedProducts);
copied to clipboard
User Subscriptions #
for getting all subscriptions of user :
final List<PurchaseInfo> subscribedProducts = await iap.getSubscribedProducts();
print(subscribedProducts);
copied to clipboard
Disconnect #
for disconnect connection of app and cafebazaar :
await iap.disconnect();
copied to clipboard
Intents #
Open application detail page #
for open details page of your app ( or another application ) you can use this method :
final _bazaar = FlutterBazaar.instance;
await _bazaar.openDetail([String packageName]);
print('USER BACK TO YOUR APP');
copied to clipboard
if packageName == null this library open details page of current packageName
note: this method is Future, and you can found when user back to app
Open Developer applications List #
for open list of all applications of developer, you can use this method :
final _bazaar = FlutterBazaar.instance;
await _bazaar.openDeveloperPage(String developerId);
print('USER BACK TO YOUR APP');
copied to clipboard
note: this method is Future, and you can found when user back to app
Open comment form #
for open comment form of this app ( or given packageName app ) use this method :
final _bazaar = FlutterBazaar.instance;
await _bazaar.openCommentForm([String packageName]);
print('USER BACK TO YOUR APP');
copied to clipboard
if packageName == null this library open comment form of current packageName
note: this method is Future, and you can found when user back to app
Update Checker #
for getting current version of your app in cafebazaar market :
final _bazaar = FlutterBazaar.instance;
final int versionCode = await _bazaar.getLatestVersion();
copied to clipboard
Login Checker #
for getting current status of logged user in cafebazaar, you can use this method :
final _bazaar = FlutterBazaar.instance;
final bool isLoggedIn = await _bazaar.isLoggedIn();
copied to clipboard
for more info check Example
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.