Android isBillingProgramAvailableAndroid
Step 1 of Billing Programs API. Check if a billing program is available for the current user.
Wraps BillingClient.isBillingProgramAvailableAsync(BillingProgram) — replaces isExternalOfferAvailableAsync. Play Billing 8.2.0+; External Offer integrations require Play Billing 8.2.1+. Billing Choice fields are available in OpenIAP Spec 2.1.0 and openiap-google 2.3.0 and require Play Billing 9.1.0+. See the Google Play Billing reference.
Signature
kt
// Returns BillingProgramAvailabilityResultAndroid with isAvailable flag
// Throws OpenIapError.NotPrepared if billing client not ready
suspend fun isBillingProgramAvailable(
program: BillingProgramAndroid
): BillingProgramAvailabilityResultAndroidParameters#
program(required,BillingProgramAndroid) — Billing program identifier.
Returns#
Promise<BillingProgramAvailabilityResultAndroid> — carries:
billingProgram(BillingProgramAndroid) — Echoes back the program that was checked.isAvailable(boolean) — Whether the billing program is available for this user/device.choiceScreenType(BillingChoiceScreenTypeAndroid| null) — Populated only for available'billing-choice'results.isExternalLinkAvailable(boolean | null) — Whether external-link developer billing is available for Billing Choice.
Example
kt
val result = openIapStore.isBillingProgramAvailable(
BillingProgramAndroid.ExternalOffer
)