-
- 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)
-
Method Summary
-
-
Constructor Detail
-
OpenIapModule
OpenIapModule(Context context)
- Parameters:
context- Android context
-
-
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()
-
getVerifyPurchase
SuspendFunction1<VerifyPurchaseProps, VerifyPurchaseResult> getVerifyPurchase()
-
getVerifyPurchaseWithProvider
SuspendFunction1<VerifyPurchaseWithProviderProps, VerifyPurchaseWithProviderResult> getVerifyPurchaseWithProvider()
-
getQueryHandlers
QueryHandlers getQueryHandlers()
-
getMutationHandlers
MutationHandlers getMutationHandlers()
-
getSubscriptionHandlers
SubscriptionHandlers getSubscriptionHandlers()
-
isBillingProgramAvailable
BillingProgramAvailabilityResultAndroid isBillingProgramAvailable(BillingProgramAndroid program)
Check if a billing program is available for this user/device (8.2.0+)
- Parameters:
program- The billing program to check, including BILLING_CHOICE on 9.1.
-
createBillingProgramReportingDetails
BillingProgramReportingDetailsAndroid createBillingProgramReportingDetails(BillingProgramAndroid program, DeveloperBillingTypeAndroid developerBillingType)
Create reporting details for transactions made outside of Google Play Billing (8.2.0+; External Offer requires 8.2.1+). Creates billing-program reporting details for external offers.
For External Offer and External Content Link, generate fresh reporting details for every session immediately before redirecting the user. Do not create or reuse a token after payment has already completed.
- Parameters:
program- The billing program, including BILLING_CHOICE on 9.1.
-
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
-
openRedeemOfferCode
Boolean openRedeemOfferCode(Activity activity)
Open the Google Play offer/promo code redemption page (https://play.google.com/redeem) so the user can enter a code. A listener can receive the redeemed purchase while the app has an active billing connection; reconcile available purchases when the app resumes. Does not require the billing client to be initialized.
- Parameters:
activity- Current activity context
-
getBillingChoiceInfo
BillingChoiceInfoAndroid getBillingChoiceInfo(GetBillingChoiceInfoParamsAndroid params)
Fetch Billing Choice display information for developer-rendered choice screens (9.1.0+).
-
showBillingProgramInformationDialog
BillingResultAndroid showBillingProgramInformationDialog(Activity activity, BillingProgramInformationDialogParamsAndroid params)
Show the mandatory information dialog before a developer-rendered, in-app Billing Choice screen (9.1.0+).
-
showInAppMessages
InAppMessageResultAndroid showInAppMessages(Activity activity, InAppMessageParamsAndroid params)
Show Play billing in-app messages, such as payment issues or price-change confirmations.
-
enableBillingProgram
final Unit enableBillingProgram(BillingProgramAndroid program)
Enable a billing program for the next BillingClient connection (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 String 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 the user selects the developer's option in an enabled billing program.
-
removeDeveloperProvidedBillingListener
Unit removeDeveloperProvidedBillingListener(OpenIapDeveloperProvidedBillingListener listener)
-
addSubscriptionBillingIssueListener
Unit addSubscriptionBillingIssueListener(OpenIapSubscriptionBillingIssueListener listener)
Add listener for subscription billing-issue events. Fires once per session when a subscription is observed with isSuspended == true.
Play flavor: populated via Purchase.isSuspended (Billing 8.1+).
Horizon flavor: NEVER fires. The Horizon Billing Compatibility SDK targets Play Billing 7.0 which does not expose a suspended-subscription signal.
-
removeSubscriptionBillingIssueListener
Unit removeSubscriptionBillingIssueListener(OpenIapSubscriptionBillingIssueListener listener)
-
onPurchasesUpdated
Unit onPurchasesUpdated(BillingResult billingResult, List<Purchase> purchases)
-
setActivity
Unit setActivity(Activity activity)
-
-
-
-