BillingRepository

Public billing contract for the toolkit.

Callers depend on this interface rather than the Play Billing implementation: the concrete class is a process-wide singleton behind a private constructor, which a consuming feature can neither substitute nor fake in a test.

It extends BillingCore because the core manager closes billing during teardown but must not see the rest of this surface, that narrower contract is what breaks the dependency cycle between :library:core:common and this module.

ProductDetails stays a Play Billing type on purpose. Offer tokens and pricing phases are read straight from it at purchase time, so a toolkit-owned copy would have to reproduce the SDK's model to stay useful.

Inheritors

Properties

Link copied to clipboard
abstract val productDetails: Flow<Map<String, ProductDetails>>

Products resolved by queryProductDetails, keyed by product id.

Link copied to clipboard
abstract val purchaseResult: Flow<PurchaseResult>

Outcome of each purchase attempt, including failures reported by the Play Billing library.

Functions

Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract fun launchInAppDonationFlow(activity: Activity, details: ProductDetails)

Starts the purchase flow for a one-time product such as a donation.

Link copied to clipboard
abstract fun launchSubscriptionFlow(activity: Activity, details: ProductDetails, offerToken: String? = null)

Starts the purchase flow for a subscription.

Link copied to clipboard
abstract suspend fun processPastPurchases()

Settles purchases that completed while the app was not running: one-time products are consumed and subscriptions are acknowledged.

Link copied to clipboard
abstract suspend fun queryProductDetails(productIds: List<String>)

Loads details for productIds and publishes them through productDetails.