-
public final class OpenIapStoreOpenIapStore (Android) Convenience store that wraps an OpenIapProtocol implementation (Play Store or Horizon) and exposes suspend APIs with observable StateFlows for UI layers to consume.
-
-
Field Summary
Fields Modifier and Type Field Description private final StateFlow<Boolean>isConnectedprivate final StateFlow<Boolean>connectionStatusprivate final StateFlow<List<Product>>productsprivate final StateFlow<List<ProductSubscription>>subscriptionsprivate final StateFlow<List<Purchase>>availablePurchasesprivate final StateFlow<Purchase>currentPurchaseprivate final StateFlow<IapStatus>statusprivate final SuspendFunction1<InitConnectionConfig, Boolean>initConnectionprivate final SuspendFunction0<Boolean>endConnectionprivate final SuspendFunction1<ProductRequest, FetchProductsResult>fetchProductsprivate final SuspendFunction1<PurchaseOptions, List<Purchase>>getAvailablePurchasesprivate final SuspendFunction1<RequestPurchaseProps, RequestPurchaseResult>requestPurchaseprivate final SuspendFunction2<Purchase, Boolean, Unit>finishTransaction
-
Constructor Summary
Constructors Constructor Description OpenIapStore(Context context)OpenIapStore(Context context, String store)OpenIapStore(Context context, String store, String appId)OpenIapStore(OpenIapProtocol module)
-
Method Summary
-
-
Method Detail
-
getIsConnected
final StateFlow<Boolean> getIsConnected()
-
getConnectionStatus
final StateFlow<Boolean> getConnectionStatus()
-
getProducts
final StateFlow<List<Product>> getProducts()
-
getSubscriptions
final StateFlow<List<ProductSubscription>> getSubscriptions()
-
getAvailablePurchases
final StateFlow<List<Purchase>> getAvailablePurchases()
-
getCurrentPurchase
final StateFlow<Purchase> getCurrentPurchase()
-
getInitConnection
final SuspendFunction1<InitConnectionConfig, Boolean> getInitConnection()
-
getEndConnection
final SuspendFunction0<Boolean> getEndConnection()
-
getFetchProducts
final SuspendFunction1<ProductRequest, FetchProductsResult> getFetchProducts()
-
getGetAvailablePurchases
final SuspendFunction1<PurchaseOptions, List<Purchase>> getGetAvailablePurchases()
-
getRequestPurchase
final SuspendFunction1<RequestPurchaseProps, RequestPurchaseResult> getRequestPurchase()
-
getFinishTransaction
final SuspendFunction2<Purchase, Boolean, Unit> getFinishTransaction()
-
setUserChoiceBillingListener
final Unit setUserChoiceBillingListener(UserChoiceBillingListener listener)
Set user choice billing listener This listener will be called when user selects alternative billing in user choice mode
- Parameters:
listener- User choice billing listener
-
setActivity
final Unit setActivity(Activity activity)
-
initConnection
final Boolean initConnection()
Convenience overload that calls initConnection with null config
-
getActiveSubscriptions
final List<ActiveSubscription> getActiveSubscriptions(List<String> subscriptionIds)
-
hasActiveSubscriptions
final Boolean hasActiveSubscriptions(List<String> subscriptionIds)
-
deepLinkToSubscriptions
final Unit deepLinkToSubscriptions(DeepLinkOptions options)
-
checkAlternativeBillingAvailability
final Boolean checkAlternativeBillingAvailability()
Step 1: Check if alternative billing is available for this user/device
-
showAlternativeBillingInformationDialog
final Boolean showAlternativeBillingInformationDialog(Activity activity)
Step 2: Show alternative billing information dialog to user Must be called BEFORE processing payment
- Parameters:
activity- Current activity context
-
createAlternativeBillingReportingToken
final String createAlternativeBillingReportingToken()
Step 3: Create external transaction token for alternative billing Must be called AFTER successful payment in your payment system Token must be reported to Google Play backend within 24 hours
-
addPurchaseUpdateListener
final Unit addPurchaseUpdateListener(OpenIapPurchaseUpdateListener listener)
-
removePurchaseUpdateListener
final Unit removePurchaseUpdateListener(OpenIapPurchaseUpdateListener listener)
-
addPurchaseErrorListener
final Unit addPurchaseErrorListener(OpenIapPurchaseErrorListener listener)
-
removePurchaseErrorListener
final Unit removePurchaseErrorListener(OpenIapPurchaseErrorListener listener)
-
addUserChoiceBillingListener
final Unit addUserChoiceBillingListener(OpenIapUserChoiceBillingListener listener)
-
removeUserChoiceBillingListener
final Unit removeUserChoiceBillingListener(OpenIapUserChoiceBillingListener listener)
-
postStatusMessage
final Unit postStatusMessage(String message, PurchaseResultStatus status, String productId)
-
clearStatusMessage
final Unit clearStatusMessage()
-
-
-
-