Entitlement

@Serializable
data class Entitlement(val id: String, val type: Entitlement.Type = Type.SERVICE_LEVEL, val isActive: Boolean = false, val productIds: Set<String> = emptySet(), val latestProductId: String? = null, val startsAt: Date? = null, val renewedAt: Date? = null, val expiresAt: Date? = null, val isLifetime: Boolean? = null, val willRenew: Boolean? = null, val state: LatestSubscriptionState? = null, val offerType: LatestPeriodType? = null, val store: Store? = null)(source)

An entitlement that represents a subscription tier in your app.

Constructors

Link copied to clipboard
constructor(id: String, type: Entitlement.Type = Type.SERVICE_LEVEL, isActive: Boolean = false, productIds: Set<String> = emptySet(), latestProductId: String? = null, startsAt: Date? = null, renewedAt: Date? = null, expiresAt: Date? = null, isLifetime: Boolean? = null, willRenew: Boolean? = null, state: LatestSubscriptionState? = null, offerType: LatestPeriodType? = null, store: Store? = null)
constructor(id: String)

Convenience constructor for creating an entitlement with just an ID.

constructor(id: String, type: Entitlement.Type)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
@Serializable
enum Type : Enum<Entitlement.Type>

Properties

Link copied to clipboard
@SerialName(value = "expiresAt")
@Serializable(with = DateSerializer::class)
val expiresAt: Date?

The expiry date of the last transaction that unlocked this entitlement.

Link copied to clipboard
@SerialName(value = "identifier")
val id: String

The identifier for the entitlement.

Link copied to clipboard
@SerialName(value = "isActive")
val isActive: Boolean

Indicates whether there is any active, non-revoked, transaction for this entitlement.

Link copied to clipboard

Indicates whether the last subscription transaction associated with this entitlement is in a billing grace period state.

Link copied to clipboard
@SerialName(value = "isLifetime")
val isLifetime: Boolean?

Indicates whether the entitlement is active for a lifetime due to the purchase of a non-consumable.

Link copied to clipboard

Indicates whether the last subscription transaction associated with this entitlement was revoked.

Link copied to clipboard
@SerialName(value = "latestProductId")
val latestProductId: String?

The product identifier of the latest transaction to unlock this entitlement.

Link copied to clipboard
@SerialName(value = "offerType")
val offerType: LatestPeriodType?

The type of offer that applies to the last subscription transaction that unlocks this entitlement.

Link copied to clipboard
@SerialName(value = "productIds")
val productIds: Set<String>

All product identifiers that map to the entitlement.

Link copied to clipboard
@SerialName(value = "renewedAt")
@Serializable(with = DateSerializer::class)
val renewedAt: Date?

The date that the entitlement was last renewed.

Link copied to clipboard

The Date at which the subscription renews, if at all.

Link copied to clipboard
@SerialName(value = "startsAt")
@Serializable(with = DateSerializer::class)
val startsAt: Date?

The purchase date of the first transaction that unlocked this entitlement.

Link copied to clipboard
@SerialName(value = "state")
val state: LatestSubscriptionState?

The state of the last subscription transaction associated with the entitlement.

Link copied to clipboard
@SerialName(value = "store")
val store: Store?

The store where the product that unlocked this entitlement was purchased.

Link copied to clipboard
@SerialName(value = "type")
val type: Entitlement.Type

The type of entitlement.

Link copied to clipboard
@SerialName(value = "willRenew")
val willRenew: Boolean?

Indicates whether the last subscription transaction associated with this entitlement will auto renew.

Functions

Link copied to clipboard

Returns true if this entitlement differs from other on any field other than the product identifiers (productIds, latestProductId).