Features • Development • Usage • License • Contribution
IAP is an Android library to handle In-App purchases with minimal code.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.akshaaatt:Google-IAP:1.7.0'
}
gradlew build
command to build the project directly or use the IDE to run the project to your phone or the emulator.val iapConnector = IapConnector(
context = this, // activity / context
nonConsumableKeys = nonConsumablesList, // pass the list of non-consumables
consumableKeys = consumablesList, // pass the list of consumables
subscriptionKeys = subsList, // pass the list of subscriptions
key = "LICENSE KEY", // pass your app's license key
enableLogging = true // to enable / disable logging
)
iapConnector.addPurchaseListener(object : PurchaseServiceListener {
override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.SkuDetails>) {
// list of available products will be received here, so you can update UI with prices if needed
}
override fun onProductPurchased(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered whenever purchase succeeded
}
override fun onProductRestored(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered fetching owned products using IapConnector
}
})
iapConnector.addSubscriptionListener(object : SubscriptionServiceListener {
override fun onSubscriptionRestored(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered upon fetching owned subscription upon initialization
}
override fun onSubscriptionPurchased(purchaseInfo: DataWrappers.PurchaseInfo) {
// will be triggered whenever subscription succeeded
}
override fun onPricesUpdated(iapKeyPrices: Map<String, DataWrappers.SkuDetails>) {
// list of available products will be received here, so you can update UI with prices if needed
}
})
iapConnector.purchase(this, "<sku>")
iapConnector.subscribe(this, "<sku>")
iapConnector.unsubscribe(this, "<sku>")
Add your products to the developer console
Replace the key with your App's License Key
https://play.google.com/store/apps/details?id=com.redalck.gameone
https://play.google.com/store/apps/details?id=com.redalck.gametwo
https://play.google.com/store/apps/details?id=com.redalck.gamethree
https://play.google.com/store/apps/details?id=com.redalck.gamefour
https://play.google.com/store/apps/details?id=com.redalck.gamefive
https://play.google.com/store/apps/details?id=com.redalck.gamesix
https://play.google.com/store/apps/details?id=com.redalck.gameseven
https://play.google.com/store/apps/details?id=com.redalck.gameeight
https://play.google.com/store/apps/details?id=daily.status.earn.money
This Project is licensed under the GPL version 3 or later.
You are most welcome to contribute to this project!