Package-level declarations

The SDK entry point, purchase and entitlement configuration, customer information, and purchase results.

Start with Purchases, then define products and entitlements with PurchaseConfiguration and the options to sell with PurchaseCatalog. Read access from CustomerInfo.

Types

Link copied to clipboard
data class ActivePurchase(val purchaseToken: String, val productIdentifiers: Set<String>, val kind: ProductKind)

A current purchase that the app can replace when changing subscriptions.

Link copied to clipboard
data class CustomerEntitlement(val identifier: String, val displayName: String = identifier, val productIdentifier: String? = null, val environment: StoreEnvironment = StoreEnvironment.Unknown, val status: CustomerEntitlementStatus = CustomerEntitlementStatus.Active, val active: Boolean, val startsAt: Instant? = null, val expiresAt: Instant? = null, val revokedAt: Instant? = null, val lastVerifiedAt: Instant, val basePlanIdentifier: String? = null, val offerIdentifier: String? = null, val store: EntitlementStore = EntitlementStore.GooglePlay, val ownershipType: EntitlementOwnershipType = EntitlementOwnershipType.Purchased, val scopes: Set<EntitlementScope> = if (ownershipType == EntitlementOwnershipType.Granted) setOf(EntitlementScope.Account) else setOf(EntitlementScope.Store))

An entitlement resolved from facts provided by the store.

Link copied to clipboard

The current status of a customer entitlement.

Link copied to clipboard
data class CustomerInfo(val source: CustomerInfoSource, val customerIdentifiers: Set<String> = emptySet(), val entitlements: List<CustomerEntitlement> = emptyList())

Entitlements resolved from every purchase of the current store account.

Link copied to clipboard

The source used to resolve customer information.

Link copied to clipboard

The method used to resolve customer entitlements.

Link copied to clipboard
data class EntitlementRepublication(val requestIdentifier: String, val status: EntitlementRepublicationStatus, val deliveryCount: Int)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class EntitlementSynchronizationResult(val customerInfo: CustomerInfo, val republications: List<EntitlementRepublication>)
Link copied to clipboard
data class PaywallConfigurationUpdate(val identifier: String, val localeIdentifier: String, val configuration: ResolvedPaywallConfiguration)

An update to a remote paywall for an identifier and locale.

Link copied to clipboard
data class PaywallProductDisplayContent(val productIdentifier: String, val title: String? = null, val description: String? = null)

Display text for a product on a remote paywall.

Link copied to clipboard
data class PaywallPurchaseOptionDisplayContent(val purchaseOptionIdentifier: String, val title: String? = null, val description: String? = null)
Link copied to clipboard

The product types supported by the SDK.

Link copied to clipboard
data class PurchaseCatalog(val identifier: String, val options: List<PurchaseOption>)

The purchase options to sell and their display order.

Link copied to clipboard
data class PurchaseConfiguration(val entitlements: List<PurchaseEntitlement>, val products: List<PurchaseProduct>)

The complete entitlement configuration of the app.

Link copied to clipboard
data class PurchaseEntitlement(val identifier: String, val displayName: String = identifier)

An entitlement provided by the app.

Link copied to clipboard
data class PurchaseOption(val identifier: String, val productIdentifier: String, val basePlanIdentifier: String? = null, val offerIdentifier: String? = null)

A combination of a product, base plan, and offer that customers choose on a paywall.

Link copied to clipboard
data class PurchasePricingPhase(val formattedPrice: String, val priceAmountMicros: Long, val currencyCode: String, val billingPeriod: String, val billingCycleCount: Int, val recurring: Boolean)

A pricing phase returned by the store.

Link copied to clipboard
data class PurchaseProduct(val productIdentifier: String, val entitlementIdentifiers: Set<String>, val kind: ProductKind = ProductKind.Subscription)

A mapping between a store product and the entitlements it grants.

Link copied to clipboard

The result of a purchase.

Link copied to clipboard
class Purchases

The app-wide entry point for Google Play purchases and Purpl entitlements.

Link copied to clipboard
data class PurchasesConfiguration(val purchaseConfiguration: PurchaseConfiguration? = null, val entitlementMode: EntitlementMode = EntitlementMode.GooglePlay, val googlePlayPublicKey: String? = null, val serverBaseUrl: String = "https://api.purpl.sh", val applicationAccountIdentifier: String? = null)

Configuration for server connections and device verification.

Link copied to clipboard

The kinds of errors that distinguish purchase failures.

Link copied to clipboard
class PurchasesException(val code: PurchasesErrorCode, message: String, cause: Throwable? = null, val serverErrorCode: String? = null, val retryable: Boolean = false, val purchaseRejected: Boolean = false) : Exception

An error thrown by Purpl purchase and entitlement operations.

Link copied to clipboard
data class ResolvedPaywallConfiguration(val catalog: PurchaseCatalog, val purchaseConfiguration: PurchaseConfiguration, val defaultPurchaseOptionIdentifier: String? = null, val productDisplayContents: List<PaywallProductDisplayContent> = emptyList(), val purchaseNotice: String? = null, val privacyPolicyUrl: String? = null, val termsOfServiceUrl: String? = null, val purchaseOptionDisplayContents: List<PaywallPurchaseOptionDisplayContent> = emptyList())

A paywall configuration resolved from local or remote sources.

Link copied to clipboard

The store environment associated with a purchase or entitlement.

Link copied to clipboard
data class StorePurchaseOption(val option: PurchaseOption, val title: String, val description: String, val formattedPrice: String, val pricingPhases: List<PurchasePricingPhase>, val kind: ProductKind)

A purchase option currently available from the store, with its price.

Link copied to clipboard
data class SubscriptionReplacement(val purchaseToken: String, val mode: SubscriptionReplacementMode)

A request to replace an existing subscription purchase.

Link copied to clipboard

How billing and entitlement timing apply when a subscription changes.