Skip to main content

1.3.0 - PurchaseState Cleanup & API Consolidation

· One min read
Hyo

This release reflects the OpenIAP gql v1.3.11 / google v1.3.21 / apple v1.3.9 updates.

Breaking Changes

PurchaseState Simplified

// Before (v1.2.x)
enum class PurchaseState {
Pending, Purchased, Failed, Restored, Deferred, Unknown
}

// After (v1.3.0)
enum class PurchaseState {
Pending, Purchased, Unknown
}

Migration:

// Before
when (purchase.purchaseState) {
PurchaseState.Purchased, PurchaseState.Restored -> handleSuccess()
PurchaseState.Pending, PurchaseState.Deferred -> handlePending()
PurchaseState.Failed -> handleFailure()
else -> {}
}

// After
when (purchase.purchaseState) {
PurchaseState.Purchased -> handleSuccess()
PurchaseState.Pending -> handlePending()
PurchaseState.Unknown -> {}
}
// Handle failures via purchaseErrorListener

API Consolidation: BillingProgramAndroid

AlternativeBillingModeAndroid deprecated. Use BillingProgramAndroid with enableBillingProgramAndroid.

// Before (deprecated)
val config = InitConnectionConfig(
alternativeBillingModeAndroid = AlternativeBillingModeAndroid.UserChoice
)

// After (recommended)
val config = InitConnectionConfig(
enableBillingProgramAndroid = BillingProgramAndroid.UserChoiceBilling
)
Before (Deprecated)After (Recommended)
alternativeBillingModeAndroid: USER_CHOICEenableBillingProgramAndroid: USER_CHOICE_BILLING
alternativeBillingModeAndroid: ALTERNATIVE_ONLYenableBillingProgramAndroid: EXTERNAL_OFFER

RequestPurchaseProps.useAlternativeBilling Deprecated

useAlternativeBilling field is deprecated - it only logged debug info and had no effect on the purchase flow.

Installation

implementation("io.github.hyochan:kmp-iap:1.3.0")

References