API reference

Purchase Class

Modifiers: final
Represents an in-app billing purchase.
The equivalent Google Play Billing Library class can be found at the Android developer documentation for Purchase.

Signature

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 = "")

Constructors

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

Properties

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

Functions

getAccountIdentifiers ()
Returns account identifiers that were provided when the purchase was made.
Signature
fun getAccountIdentifiers(): AccountIdentifiers
getPendingPurchaseUpdate ()
Returns the PendingPurchaseUpdate for an uncommitted transaction.
Signature
fun getPendingPurchaseUpdate(): Purchase.PendingPurchaseUpdate
Returns
Purchase.PendingPurchaseUpdate
getPurchaseState ()
Returns one of Purchase.PurchaseState indicating the state of the purchase.
Signature
fun getPurchaseState(): Int
Returns
Int
getSkus ()
DeprecatedUse [getProducts] instead.
Signature
fun getSkus(): List<String>
Returns
List
isAcknowledged ()
Indicates whether the purchase has been acknowledged.
Signature
fun isAcknowledged(): Boolean
Returns
Boolean
isAutoRenewing ()
Indicates whether the subscription renews automatically.
This method returns true for all subscriptions. We plan to fix this in a future version by returning true only if the subscription is still active.
Signature
fun isAutoRenewing(): Boolean
Returns
Boolean

Inner Class

PendingPurchaseUpdate Class

Modifiers: final
Represents a pending change/update to the existing purchase.

Signature

data class PendingPurchaseUpdate(val products: List<String>, val purchaseToken: String)

Constructors

PendingPurchaseUpdate ( products , purchaseToken )
Signature
constructor(products: List<String>, purchaseToken: String)
Parameters
products: List
  The product ids.
purchaseToken: String
  A token that uniquely identifies this pending transaction.
Returns
Purchase.PendingPurchaseUpdate

Properties

products : List
[Get]
The product ids.
Signature
val products: List<String>
purchaseToken : String
[Get]
A token that uniquely identifies this pending transaction.
Signature
val purchaseToken: String

Inner Annotation

PurchaseState Annotation

Possible purchase states.

Signature

annotation class PurchaseState

Constructors

PurchaseState ()
Signature
constructor()
Returns
Purchase.PurchaseState

Companion Object

Companion Object Properties
PENDING : Int
[Get]
Signature
const val PENDING: Int = 2
PURCHASED : Int
[Get]
Signature
const val PURCHASED: Int = 1
UNSPECIFIED_STATE : Int
[Get]
Signature
const val UNSPECIFIED_STATE: Int = 0
Did you find this page helpful?