kmp-iap
April 14, 2026 · View on GitHub
⚠️ This repository has moved to the OpenIAP monorepo. This repository is deprecated and will be archived soon. All future development happens in the monorepo. See the 📢 announcement issue or the discussion thread for details. This repository is deprecated and will be archived soon. All future development happens in the monorepo. Please see the announcement for details.
kmp-iap
A comprehensive Kotlin Multiplatform library for in-app purchases on Android and iOS platforms that conforms to the Open IAP specification
📚 Documentation
Visit the documentation site for installation guides, API reference, and examples:
hyochan.github.io/kmp-iap
Using with AI Assistants
kmp-iap provides AI-friendly documentation for Cursor, GitHub Copilot, Claude, and ChatGPT.
Quick links:
- llms.txt - Quick reference (~300 lines)
- llms-full.txt - Full API reference (~1000 lines)
📦 Installation
dependencies {
implementation("io.github.hyochan:kmp-iap:1.3.8")
}
🚀 Quick Start
Option 1: Using Global Instance (Simple)
import io.github.hyochan.kmpiap.kmpIapInstance
import io.github.hyochan.kmpiap.*
// Use the global singleton instance
kmpIapInstance.initConnection()
// Get products - DSL API in v1.0.0-rc.2
val products = kmpIapInstance.fetchProducts {
skus = listOf("product_id")
type = ProductQueryType.InApp
}
// Request purchase - DSL API with platform-specific options
val purchase = kmpIapInstance.requestPurchase {
ios {
sku = "product_id"
quantity = 1
}
android {
skus = listOf("product_id")
}
}
// Or just for one platform
val iosPurchase = kmpIapInstance.requestPurchase {
ios {
sku = "product_id"
}
}
// Finish transaction (after server-side validation)
kmpIapInstance.finishTransaction(
purchase = purchase.toPurchaseInput(),
isConsumable = true // true for consumables, false for subscriptions
)
Option 2: Create Your Own Instance (Recommended for Testing)
import io.github.hyochan.kmpiap.KmpIAP
import io.github.hyochan.kmpiap.*
// Create your own instance
val kmpIAP = KmpIAP()
// Initialize connection
kmpIAP.initConnection()
// Get products - DSL API in v1.0.0-rc.2
val products = kmpIAP.fetchProducts {
skus = listOf("product_id")
type = ProductQueryType.InApp
}
// Request purchase - DSL API with platform-specific options
val purchase = kmpIAP.requestPurchase {
ios {
sku = "product_id"
quantity = 1
}
android {
skus = listOf("product_id")
}
}
// Or just for one platform
val androidPurchase = kmpIAP.requestPurchase {
android {
skus = listOf("product_id")
}
}
// Finish transaction (after server-side validation)
kmpIAP.finishTransaction(
purchase = purchase.toPurchaseInput(),
isConsumable = true // true for consumables, false for subscriptions
)
Powered by OpenIAP
kmp-iap conforms to the OpenIAP specification — an open, vendor-neutral interoperability standard for in-app purchases. OpenIAP provides:
- Shared specification — Common types, error codes, and purchase flows across all platforms
- Generated type-safe bindings — Swift, Kotlin, Dart, and GDScript from a single GraphQL schema
- Platform implementations — openiap-apple (StoreKit 2) and openiap-google (Play Billing 8.x)
- Verification profiles — Standardized receipt validation and purchase verification patterns
Other libraries built on OpenIAP: react-native-iap · expo-iap · flutter_inapp_purchase · godot-iap
Learn more about the OpenIAP standard →
📄 License
MIT License - see LICENSE file for details.
