-
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
-
setDeveloperProvidedBillingListener
final Unit setDeveloperProvidedBillingListener(DeveloperProvidedBillingListener listener)
Set a developer-provided billing listener for External Payments (8.3.0+ Japan only). This is called when user selects developer billing in the side-by-side choice dialog.
- Parameters:
listener- Developer-provided billing listener or null to remove
-
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
@Deprecated(message = Use isBillingProgramAvailable with BillingProgramAndroid.ExternalOffer instead) final Boolean checkAlternativeBillingAvailability()
Step 1: Check if alternative billing is available for this user/device
-
showAlternativeBillingInformationDialog
@Deprecated(message = Use launchExternalLink instead) 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
@Deprecated(message = Use createBillingProgramReportingDetails with BillingProgramAndroid.ExternalOffer instead) 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
-
isBillingProgramAvailable
final BillingProgramAvailabilityResultAndroid isBillingProgramAvailable(BillingProgramAndroid program)
Check if a billing program is available for this user/device. This is the new API that replaces checkAlternativeBillingAvailability for external offers.
- Parameters:
program- The billing program to check (EXTERNAL_CONTENT_LINK or EXTERNAL_OFFER)
-
createBillingProgramReportingDetails
final BillingProgramReportingDetailsAndroid createBillingProgramReportingDetails(BillingProgramAndroid program)
Create reporting details for transactions made outside of Google Play Billing. This is the new API that replaces createAlternativeBillingReportingToken for external offers.
- Parameters:
program- The billing program (EXTERNAL_CONTENT_LINK or EXTERNAL_OFFER)
-
launchExternalLink
final Boolean launchExternalLink(Activity activity, LaunchExternalLinkParamsAndroid params)
Launch an external link for external offer or app download. This is the new API that replaces showAlternativeBillingInformationDialog for external offers.
- Parameters:
activity- Current activity contextparams- Parameters for the external link
-
enableBillingProgram
final Unit enableBillingProgram(BillingProgramAndroid program)
Enable a billing program for external content links or external offers (8.2.0+). This should be called BEFORE initConnection to configure the BillingClient.
- Parameters:
program- The billing program to enable (ExternalOffer or ExternalContentLink)
-
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)
-
addDeveloperProvidedBillingListener
final Unit addDeveloperProvidedBillingListener(OpenIapDeveloperProvidedBillingListener listener)
-
removeDeveloperProvidedBillingListener
final Unit removeDeveloperProvidedBillingListener(OpenIapDeveloperProvidedBillingListener listener)
-
postStatusMessage
final Unit postStatusMessage(String message, PurchaseResultStatus status, String productId)
-
clearStatusMessage
final Unit clearStatusMessage()
-
-
-
-