Last updated:
0 purchases
myket iap
myket_iap #
Myket In-App Purchase plugin android apps. This plugin is for android apps only.
Getting Started #
Import this line in Flutter pubspec #
myket_iap: <Last Version>
copied to clipboard
Migrate from 1.0.6 to 1.1.0 #
Remove Permission from Android Manifest.
<uses-permission android:name="ir.mservices.market.BILLING" />
copied to clipboard
Remove queries from Android Manifest.
<queries>
<package android:name="ir.mservices.market" />
<intent>
<action android:name="ir.mservices.market.InAppBillingService.BIND" />
<data android:mimeType="*/*" />
</intent>
</queries>
copied to clipboard
Add gradle properties explained below.
Updating Your Application's Gradle #
Add this code snippet to your build.gradle defaultConfig:
android {
defaultConfig {
def marketApplicationId = "ir.mservices.market"
def marketBindAddress = "ir.mservices.market.InAppBillingService.BIND"
manifestPlaceholders += [marketApplicationId: "${marketApplicationId}",
marketBindAddress : "${marketBindAddress}",
marketPermission : "${marketApplicationId}.BILLING"]
}
compileOptions {
sourceCompatibility 17
targetCompatibility 17
}
...
}
copied to clipboard
Make sure you are using kotlin >= 1.9.10 and java 17
Multiple Store #
Myket Iap can support multiple store. For using this feature, use flavor in your gradle file and in your flutter.
For more information about flavors in flutter read this document.
To Use myket iap plugin import below code to your class(your payment class) #
import 'package:myket_iap/myket_iap.dart';
copied to clipboard
All method be static and don't need to initialize any class
First of all initialize payment and ras Key #
use this method in your initState() method.
IabResult result = await MyketIAP.init(rsaKey:"Your RSA Key From myket", enableDebugLogging: true);
copied to clipboard
rsaKey : Public key retrieved from myket developer panel
enableDebugLogging : enable or disable debug log
To start a purchase request from your app, call the launchPurchaseFlow method on the In-app Billing plugin #
Map<String, dynamic> result = await MyketIAP.launchPurchaseFlow(sku: "gas", payload:"payload");
copied to clipboard
sku : your product id on Myket (created in myket developer panel)
payload : The developerPayload String is used to specify any additional arguments that you want Myket to send back along with the purchase information.
The result will be a map containing MyketIAP.RESULT as IabResult object, and MyketIAP.PURCHASE as Purchase object.
after getting result from launchPurchaseFlow, if your purchase is consumable, you should consume it #
Map<String, dynamic> consumeResultMap = await MyketIAP.consume(purchase: purchase);
copied to clipboard
purchase : previously bought item
The result will be a map containing MyketIAP.RESULT as IabResult object, and MyketIAP.PURCHASE as consumed Purchase object.
if you want to know state of a purchase use this method #
Map<String, dynamic> result = await MyketIAP.getPurchase(sku: "gas", querySkuDetails: false);
copied to clipboard
sku : your product id on Myket (created in myket developer panel)
querySkuDetails : if true, SKU details (price, description, etc) will be queried as well as purchase information.
The result will be a map containing MyketIAP.RESULT as IabResult object, and MyketIAP.PURCHASE as consumed Purchase object.
Query the inventory #
This will query all owned items from the server, as well as information on additional skus, if specified.
Map<String, dynamic> result = await MyketIAP.queryInventory(querySkuDetails: false);
copied to clipboard
querySkuDetails : if true, SKU details (price, description, etc) will be queried as well as purchase information.
The result will be a map containing MyketIAP.RESULT as IabResult object, and MyketIAP.INVENTORY as Inventory object.
Dispose #
Dispose of object, releasing resources. It's very important to call this method when you are done with this object. It will release any resources used by it such as service connections. Naturally, once the object is disposed of, it can't be used again.
await MyketIAP.dispose();
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.