KMP-IAP 1.2.2 is a patch release that adds support for Google Play Billing Library 8.3.0's External Payments API, enabling side-by-side choice billing for users in Japan.
What's New
External Payments Support (Android 8.3.0+)
Added support for Google Play's External Payments billing program, which presents users with a side-by-side choice between Google Play Billing and the developer's external payment option directly in the purchase flow.
Japan Only
The External Payments program is currently only available for users in Japan.
New APIs
InitConnectionConfig.enableBillingProgramAndroid- Enable a billing program during connection initializationdeveloperProvidedBillingListener: Flow<DeveloperProvidedBillingDetailsAndroid>- Listen for developer billing selectionBillingProgramAndroid.ExternalPayments- New billing program enum value
New Types
DeveloperBillingOptionParamsAndroid- Configure external payment in purchase flowDeveloperBillingLaunchModeAndroid- How to launch the external payment linkDeveloperProvidedBillingDetailsAndroid- ContainsexternalTransactionTokenwhen user selects developer billing
Usage Example
import io.github.hyochan.kmpiap.kmpIapInstance
import io.github.hyochan.kmpiap.openiap.*
// Enable External Payments during connection initialization
val config = InitConnectionConfig(
enableBillingProgramAndroid = BillingProgramAndroid.ExternalPayments
)
kmpIapInstance.initConnection(config)
// Listen for developer billing selection
scope.launch {
kmpIapInstance.developerProvidedBillingListener.collect { details ->
println("External Transaction Token: ${details.externalTransactionToken}")
// Report token to Google within 24 hours
}
}
// Request purchase with External Payments option
kmpIapInstance.requestPurchase {
android {
skus = listOf("premium_product")
developerBillingOption = DeveloperBillingOptionParamsAndroid(
billingProgram = BillingProgramAndroid.ExternalPayments,
launchMode = DeveloperBillingLaunchModeAndroid.LaunchInExternalBrowserOrApp,
linkUri = "https://your-site.com/checkout"
)
}
}
Key Differences from User Choice Billing
| Feature | User Choice Billing | External Payments |
|---|---|---|
| Billing Library | 7.0+ | 8.3.0+ |
| Availability | Eligible regions | Japan only |
| UI | Separate dialog | Side-by-side in purchase dialog |
| Token Source | userChoiceBillingListener | developerProvidedBillingListener |
OpenIAP Dependency Updates
Updated to the latest OpenIAP versions:
openiap-apple: 1.3.8 (was 1.3.7)openiap-google: 1.3.19 (was 1.3.15)openiap-gql: 1.3.10 (was 1.3.8)
Installation
Gradle (Kotlin DSL)
// shared/build.gradle.kts
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.hyochan:kmp-iap:1.2.2")
}
}
}
Version Catalog (libs.versions.toml)
[versions]
kmp-iap = "1.2.2"
[libraries]
kmp-iap = { module = "io.github.hyochan:kmp-iap", version.ref = "kmp-iap" }
CocoaPods
pod 'kmp-iap', '~> 1.2.2'
Documentation
- Alternative Billing Guide - Updated with External Payments section
- External Payment Links (Google) - Official documentation
References
- 1.2.1 Release Notes - Previous patch release
- 1.2.0 Release Notes - Full feature release notes
- API Reference - Core Methods
- GitHub Release
Questions or feedback? Reach out via GitHub Issues.
