Contents

currentEntitlements

A sequence of the latest transactions that entitle a customer to In-App Purchases and subscriptions.

Declaration

static var currentEntitlements: Transaction.Transactions { get }

Mentioned in

Discussion

The current entitlements sequence emits the latest transaction for each product the customer has an entitlement to, specifically:

Products that the App Store has refunded or revoked don’t appear in the current entitlements. Consumable In-App Purchases also don’t appear in the current entitlements. To get transactions for unfinished consumables, use the unfinished or all sequences in Transaction.

The following example illustrates iterating through the current entitlements:

func refreshPurchasedProducts() async {
    // Iterate through the user's purchased products.
    for await verificationResult in Transaction.currentEntitlements {
        switch verificationResult {
        case .verified(let transaction):
            // Check the type of product for the transaction
            // and provide access to the content as appropriate.
            ...
        case .unverified(let unverifiedTransaction, let verificationError):
            // Handle unverified transactions based on your
            // business model.
            ...
        }
    }
}

See Also

Transaction history and entitlements