diff --git a/sdk/src/main/java/com/qonversion/android/sdk/internal/QProductCenterManager.kt b/sdk/src/main/java/com/qonversion/android/sdk/internal/QProductCenterManager.kt index 0009f57d..428a43ed 100644 --- a/sdk/src/main/java/com/qonversion/android/sdk/internal/QProductCenterManager.kt +++ b/sdk/src/main/java/com/qonversion/android/sdk/internal/QProductCenterManager.kt @@ -89,6 +89,8 @@ internal class QProductCenterManager internal constructor( private var advertisingID: String? = null private var pendingInitRequestData: InitRequestData? = null + private var processingPurchases: List = emptyList() + private var converter: PurchaseConverter = GooglePurchaseConverter() @Volatile @@ -616,6 +618,8 @@ internal class QProductCenterManager internal constructor( val completedPurchases = purchases.filter { it.purchaseState == Purchase.PurchaseState.PURCHASED } + processingPurchases = completedPurchases + val purchasesInfo = converter.convertPurchases(completedPurchases) val handledPurchasesCallback = @@ -658,6 +662,13 @@ internal class QProductCenterManager internal constructor( loadStoreProductsIfPossible() + if (processingPurchases.isNotEmpty()) { + handledPurchasesCache.saveHandledPurchases(processingPurchases) + + billingService.consumePurchases(processingPurchases.toList()) + processingPurchases = emptyList() + } + handleCachedPurchases() callback?.onSuccess(launchResult)