iOS - Observer mode

If you have a functioning subscription system and want to give Adapty SDK a quick try, you can use Observer mode. With just one line of code you can:



When running in Observer mode, Adapty SDK won't close any transactions, so make sure you're handling it.

Activating Observer Mode

Adapty SDK will automatically collect all transactions and will be sending subscription events. To turn on Observer mode, just set observerMode to true when activating Adapty.

Adapty.activate("PUBLIC_SDK_KEY", observerMode: true, customerUserId: "YOUR_USER_ID")

// And at any purchase or restore in your application

Adapty.restorePurchases { result in
    switch result {
        case .success:
            // successful restore
        case let .failure(error):
            // handle the error

A/B tests analytics

In Observer mode, Adapty SDK doesn't know, where the purchase was made from. If you display products using our Paywalls or A/B Tests, you can manually assign variation to the purchase. After doing this, you'll be able to see metrics in Adapty Dashboard.

let variationId = paywall.variationId

// There are two overloads: for StoreKit 1 and StoreKit 2
Adapty.setVariationId(variationId, forPurchasedTransaction: transaction) { error in
    if error == nil {
        // successful binding

Request parameters:

  • variationId (required): a string identifier of variation. You can get it using variationId property of Paywall
  • transaction (required): an SKPaymentTransaction object in case of StoreKit 1 and Transaction object in case of StoreKit 2

We recommend delaying the call for setting the variation ID until after the Recipe validation and implementing a retry logic with a delay of 5 seconds and a limit of 3 attempts. This approach can help ensure that the variation ID is set correctly and reduce the likelihood of errors or unexpected behavior.


AdaptySDK observes transactions for both the StoreKit 1 and StoreKit 2 frameworks. If you are using StoreKit 2 to implement purchase logic, make sure to set up all the keys in the Adapty Dashboard. Read More.