Skip to main content
You can check subscription status and manage user access to the premium content on your app by checking user entitlements with the checkEntitlements() method. Entitlement is access to the premium features of your application. → Read more about creating and using entitlements here. You need to call the checkEntitlements() method at the start of your app to check if a user has the required entitlement. This method will check the user’s receipt and return current entitlements. In addition, Qonversion can manage cross-platform entitlements with the user Identity concept (e.g. after your users subscribe using the IOS app, you can use Qonversion to check their entitlements in your Android or Web applications)
Qonversion SDK caches all required data on products, offerings, and entitlements. The data is still immediately available when the internet connection is lost, or there are server-side delays.
Note, please, that the entitlement object is available only in case the user has made a purchase, or you granted the entitlement manually using the Customer tab or Grant Entitlement API. In other cases, you will receive an empty result.
Qonversion.shared().checkEntitlements { (entitlements, error) in
  if let error = error {
    // handle error
    return
  }
  
  if let premium: Qonversion.Entitlement = entitlements["premium"], premium.isActive {
    switch premium.renewState {
      case .willRenew, .nonRenewable:
        // .willRenew is the state of an auto-renewable subscription 
        // .nonRenewable is the state of consumable/non-consumable IAPs that could unlock lifetime access
        break
      case .billingIssue:
        // Grace period: entitlement is active, but there was some billing issue.
        // Prompt the user to update the payment method.
        break
      case .cancelled:
        // The user has turned off auto-renewal for the subscription, but the subscription has not expired yet.
        // Prompt the user to resubscribe with a special offer.
        break
      default: break
    }
  }
}

The Entitlement Object

Var NameDescription
idQonversion entitlements ID. For example, premium
isActiveBoolean. true means a user has active entitlement. Please note that isActive = true does not mean a subscription will be renewed. A user can have active entitlement while auto-renewal for the subscription is switched off.
sourceSource of the purchase via which the entitlement was activated. Values: – appstore: App Store – playstore: Play Store – stripe: Stripe – unknown: unable to detect the source – manual: the entitlement was activated manually
startedDateInitial transaction date. For a subscription with a trial period, the date will be when the trial starts.
trialStartDateThe trial start date for current entitlement. Null for entitlement that was unlocked by consumable/non-consumable/lifetime purchase or subscription without a trial period.
firstPurchaseDateThe date of the first purchase.
lastPurchaseDateThe date of the last purchase.
autoRenewDisableDateThe date when auto-renew for the subscription was disabled.
expirationDateThe expiration date for a subscription. Null for a consumable/non-consumable in-app purchase or a lifetime subscription
productIdIdentifier of the product from the Qonversion Dashboard
renewStateA renewal state of the subscription. It can have the following values: nonRenewable - consumable or non-consumable in-app purchase, willRenew – subscription is active, and auto-renew status is on, billingIssue – there was some billing issue, canceled – the subscription was cancelled, unknown - if we don’t have information about the renewal state.
renewsCountSubscription renews count for the entitlement. Renews count starts from the second paid transaction. For example, we have 20 transactions:- The first one is the trial started transaction
  • The second one is the first paid transaction, trial converted.
  • All the other - subscription renew transactions, thus renewsCount is equal to 18. | | grantType | Grant type of entitlement- purchase: User bought a subscription -familySharing: User got entitlement via family sharing
  • offerCode: User got entitlement using offer code
  • manual: User got entitlement via Qonversion dashboard feature | | lastActivatedOfferCode | The last activated offer code that unlocks the current entitlement. | | transactions | An array of Transaction objects that contains information about transactions that unlocked current entitlement. |

The Transaction object

Var NameDescription
originalTransactionIdThe original transaction identifier.
transactionIdThe transaction identifier.
offerCodeThe offer code that was used to get the transactions.
transactionDateThe date of the transaction.
expirationDateThe expiration date for the transaction. Null for a consumable/non-consumable in-app purchase or a lifetime subscription
transactionRevocationDateThe date when the transaction was revoked. This field represents the time and date the App Store refunded a transaction or revoked it from family sharing.
environmentThe environment of the transaction:- sandbox
  • production | | ownershipType | Type of the ownership for the transaction:- owner- User owns the transaction
  • familySharing- User got transaction via family sharing | | type | Type of the transaction:- subscriptionStarted
  • subscriptionRenewed
  • trialStarted
  • introStarted
  • introRenewed
  • nonConsumablePurchase |

Making Purchases Offline SDK mode