-
- All Implemented Interfaces:
-
com.android.billingclient.api.PurchasesUpdatedListener,dev.hyo.openiap.OpenIapProtocol
public final class OpenIapModule implements OpenIapProtocol, PurchasesUpdatedListener
Main OpenIapModule implementation for Android
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classOpenIapModule.Companion
-
Field Summary
-
Constructor Summary
Constructors Constructor Description OpenIapModule(Context context, Boolean enableAlternativeBilling)OpenIapModule(Context context, AlternativeBillingMode alternativeBillingMode, UserChoiceBillingListener userChoiceBillingListener, DeveloperProvidedBillingListener developerProvidedBillingListener)
-
Method Summary
-
-
Constructor Detail
-
OpenIapModule
OpenIapModule(Context context, AlternativeBillingMode alternativeBillingMode, UserChoiceBillingListener userChoiceBillingListener, DeveloperProvidedBillingListener developerProvidedBillingListener)
- Parameters:
context- Android contextalternativeBillingMode- Alternative billing mode (default: NONE)userChoiceBillingListener- Listener for user choice billing selection (optional)
-
-
Method Detail
-
getInitConnection
SuspendFunction1<InitConnectionConfig, Boolean> getInitConnection()
-
getEndConnection
SuspendFunction0<Boolean> getEndConnection()
-
getFetchProducts
SuspendFunction1<ProductRequest, FetchProductsResult> getFetchProducts()
-
getGetAvailablePurchases
SuspendFunction1<PurchaseOptions, List<Purchase>> getGetAvailablePurchases()
-
getGetActiveSubscriptions
SuspendFunction1<List<String>, List<ActiveSubscription>> getGetActiveSubscriptions()
-
getHasActiveSubscriptions
SuspendFunction1<List<String>, Boolean> getHasActiveSubscriptions()
-
getRequestPurchase
SuspendFunction1<RequestPurchaseProps, RequestPurchaseResult> getRequestPurchase()
-
getFinishTransaction
SuspendFunction2<Purchase, Boolean, Unit> getFinishTransaction()
-
getAcknowledgePurchaseAndroid
SuspendFunction1<String, Boolean> getAcknowledgePurchaseAndroid()
-
getConsumePurchaseAndroid
SuspendFunction1<String, Boolean> getConsumePurchaseAndroid()
-
getDeepLinkToSubscriptions
SuspendFunction1<DeepLinkOptions, Unit> getDeepLinkToSubscriptions()
-
getRestorePurchases
SuspendFunction0<Unit> getRestorePurchases()
-
getValidateReceipt
SuspendFunction1<VerifyPurchaseProps, VerifyPurchaseResult> getValidateReceipt()
-
getVerifyPurchase
SuspendFunction1<VerifyPurchaseProps, VerifyPurchaseResult> getVerifyPurchase()
-
getVerifyPurchaseWithProvider
SuspendFunction1<VerifyPurchaseWithProviderProps, VerifyPurchaseWithProviderResult> getVerifyPurchaseWithProvider()
-
getQueryHandlers
QueryHandlers getQueryHandlers()
-
getMutationHandlers
MutationHandlers getMutationHandlers()
-
getSubscriptionHandlers
SubscriptionHandlers getSubscriptionHandlers()
-
checkAlternativeBillingAvailability
@Deprecated(message = Use isBillingProgramAvailable with BillingProgramAndroid.ExternalOffer instead) Boolean checkAlternativeBillingAvailability()
Check if alternative billing is available for this user/device Step 1 of alternative billing flow
-
showAlternativeBillingInformationDialog
@Deprecated(message = Use launchExternalLink instead) Boolean showAlternativeBillingInformationDialog(Activity activity)
Show alternative billing information dialog to user Step 2 of alternative billing flow Must be called BEFORE processing payment
-
createAlternativeBillingReportingToken
@Deprecated(message = Use createBillingProgramReportingDetails with BillingProgramAndroid.ExternalOffer instead) String createAlternativeBillingReportingToken()
Create external transaction token for alternative billing Step 3 of alternative billing flow Must be called AFTER successful payment in your payment system Token must be reported to Google Play backend within 24 hours
-
isBillingProgramAvailable
BillingProgramAvailabilityResultAndroid isBillingProgramAvailable(BillingProgramAndroid program)
Check if a billing program is available for this user/device (8.2.0+) 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
BillingProgramReportingDetailsAndroid createBillingProgramReportingDetails(BillingProgramAndroid program)
Create reporting details for transactions made outside of Google Play Billing (8.3.0+) This is the new API that replaces createAlternativeBillingReportingToken for external offers.
Note: This method uses BillingProgramReportingDetailsParams which was introduced in 8.3.0.
- Parameters:
program- The billing program (EXTERNAL_CONTENT_LINK or EXTERNAL_OFFER)
-
launchExternalLink
Boolean launchExternalLink(Activity activity, LaunchExternalLinkParamsAndroid params)
Launch an external link for external offer or app download (8.2.0+) This is the new API that replaces showExternalOfferInformationDialog.
- 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
-
getAvailableItems
final List<Purchase> getAvailableItems(ProductQueryType type)
-
getStorefront
final <ERROR CLASS> getStorefront()
-
addPurchaseUpdateListener
Unit addPurchaseUpdateListener(OpenIapPurchaseUpdateListener listener)
-
removePurchaseUpdateListener
Unit removePurchaseUpdateListener(OpenIapPurchaseUpdateListener listener)
-
addPurchaseErrorListener
Unit addPurchaseErrorListener(OpenIapPurchaseErrorListener listener)
-
removePurchaseErrorListener
Unit removePurchaseErrorListener(OpenIapPurchaseErrorListener listener)
-
addUserChoiceBillingListener
Unit addUserChoiceBillingListener(OpenIapUserChoiceBillingListener listener)
-
removeUserChoiceBillingListener
Unit removeUserChoiceBillingListener(OpenIapUserChoiceBillingListener listener)
-
addDeveloperProvidedBillingListener
Unit addDeveloperProvidedBillingListener(OpenIapDeveloperProvidedBillingListener listener)
Add listener for developer-provided billing selection events. Called when user selects the developer's billing option in external payments flow.
-
removeDeveloperProvidedBillingListener
Unit removeDeveloperProvidedBillingListener(OpenIapDeveloperProvidedBillingListener listener)
-
onPurchasesUpdated
Unit onPurchasesUpdated(BillingResult billingResult, List<Purchase> purchases)
-
setActivity
Unit setActivity(Activity activity)
-
setUserChoiceBillingListener
Unit setUserChoiceBillingListener(UserChoiceBillingListener listener)
Set user choice billing listener
- Parameters:
listener- User choice billing listener
-
setDeveloperProvidedBillingListener
Unit setDeveloperProvidedBillingListener(DeveloperProvidedBillingListener listener)
Set legacy-style developer-provided billing listener for External Payments (8.3.0+ Japan only).
- Parameters:
listener- Developer-provided billing listener or null to remove
-
-
-
-