PurchaseResult

open class PurchaseResult

Represents the result of a purchase transaction with comprehensive details. This class wraps all information from Google Play Billing Library's Purchase object.

Constructors

Link copied to clipboard
constructor()
Default constructor for manual creation.
constructor(orderId: String, packageName: String, productIds: List<String>, purchaseTime: Long, purchaseState: Int, purchaseToken: String, quantity: Int, autoRenewing: Boolean, acknowledged: Boolean)
Legacy constructor for backward compatibility.
constructor(orderId: String, packageName: String, productIds: List<String>, purchaseTime: Long, purchaseState: Int, purchaseToken: String, quantity: Int, autoRenewing: Boolean, acknowledged: Boolean, originalJson: String, signature: String, obfuscatedAccountId: String, obfuscatedProfileId: String)
Full constructor with all fields.

Types

Link copied to clipboard
open class State
Purchase states from Google Play Billing.
Link copied to clipboard
Subscription lifecycle states.

Properties

Link copied to clipboard
open var consumedTime: Long
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var orderId: String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var purchaseState: Int
Link copied to clipboard
open var purchaseTime: Long
Link copied to clipboard
Link copied to clipboard
open var quantity: Int
Link copied to clipboard
open var signature: String

Functions

Link copied to clipboard
open fun containsProduct(productId: String): Boolean
Checks if this purchase contains a specific product ID.
Link copied to clipboard
open fun equals(o: Any): Boolean
Link copied to clipboard
open fun fromPurchase(@NonNull purchase: Purchase): PurchaseResult
Creates a PurchaseResult from a Google Play Purchase object.
Link copied to clipboard
Gets the consumed time as a formatted date string.
Link copied to clipboard
Gets the first (primary) product ID.
Link copied to clipboard
open fun getProductId(): List<String>
Link copied to clipboard
Gets the product IDs as a comma-separated string.
Link copied to clipboard
Gets the purchase time as a Date object.
Link copied to clipboard
Gets the purchase state as a readable string.
Link copied to clipboard
Gets the purchase time as a formatted date string in default format.
Gets the purchase time as a formatted date string.
Link copied to clipboard
Gets the subscription state based on available client-side data.
Link copied to clipboard
Gets a human-readable subscription status string.
Link copied to clipboard
Checks if account identifiers are available.
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
Checks if this purchase has the necessary data for server-side verification.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isInApp(): Boolean
Checks if this is an in-app (one-time) purchase.
Link copied to clipboard
open fun isPending(): Boolean
Checks if the purchase is in PENDING state.
Link copied to clipboard
open fun isPurchased(): Boolean
Checks if the purchase is in PURCHASED state.
Link copied to clipboard
Checks if this is a subscription purchase.
Link copied to clipboard
Checks if the subscription is active (user has access).
Link copied to clipboard
Checks if the user cancelled their subscription.
Link copied to clipboard
open fun markAsConsumed()
Marks this purchase as consumed.
Link copied to clipboard
open fun setAcknowledged(acknowledged: Boolean)
Link copied to clipboard
open fun setAutoRenewing(autoRenewing: Boolean)
Link copied to clipboard
open fun setProductId(productIds: List<String>)
Link copied to clipboard
open fun toString(): String
Link copied to clipboard
Checks if the subscription will renew.