API reference

Purchase

Updated: Mar 19, 2025

Purchase

data class Purchase(val purchaseTime: Long⁠, val purchaseToken: String⁠, val products: List⁠<String⁠>, val packageName: String⁠, val developerPayload: String⁠? = "", val orderId: String⁠? = "", val originalJson: String⁠? = "", val quantity: Int⁠ = 1, val signature: String⁠ = "")
Represents an in-app billing purchase.
The equivalent Google Play Billing Library class can be found at the Android developer documentation for Purchase⁠.

Constructors

NameSummary
Purchase
constructor(jsonPurchaseInfo: String⁠, signature: String⁠)constructor(purchaseTime: Long⁠, purchaseToken: String⁠, products: List⁠<String⁠>, packageName: String⁠, developerPayload: String⁠? = "", orderId: String⁠? = "", originalJson: String⁠? = "", quantity: Int⁠ = 1, signature: String⁠ = "")

Types

NameSummary
data class PendingPurchaseUpdate(val products: List⁠<String⁠>, val purchaseToken: String⁠)
Represents a pending change/update to the existing purchase.
annotation class PurchaseState
Possible purchase states.

Properties

NameSummary
developerPayload
val developerPayload: String⁠?
Returns the payload specified when the purchase was acknowledged or consumed.
orderId
val orderId: String⁠?
Returns a unique order identifier for the transaction.
originalJson
val originalJson: String⁠?
Returns a String in JSON format that contains details about the purchase order.
packageName
val packageName: String⁠
Returns the application package from which the purchase originated.
products
val products: List⁠<String⁠>
Returns the product Ids.
purchaseTime
val purchaseTime: Long⁠
Returns the time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).
purchaseToken
val purchaseToken: String⁠
Returns a token that uniquely identifies a purchase for a given item and user pair.
quantity
val quantity: Int⁠ = 1
Returns the quantity of the purchased product.
signature
val signature: String⁠

Functions

NameSummary
getAccountIdentifiers
fun getAccountIdentifiers(): AccountIdentifiers
Returns account identifiers that were provided when the purchase was made.
getPendingPurchaseUpdate
fun getPendingPurchaseUpdate(): Purchase.PendingPurchaseUpdate
Returns the PendingPurchaseUpdate for an uncommitted transaction.
getPurchaseState
fun getPurchaseState(): Int⁠
Returns one of PurchaseState indicating the state of the purchase.
getSkus
fun getSkus(): List⁠<String⁠>
isAcknowledged
fun isAcknowledged(): Boolean⁠
Indicates whether the purchase has been acknowledged.
isAutoRenewing
fun isAutoRenewing(): Boolean⁠
Indicates whether the subscription renews automatically.