Skip to main content
Version: 2.0

Associate paywalls to purchase transactions in Observer mode

In Observer mode, Adapty SDK cannot determine the source of purchases as you are the one processing them. Therefore, if you intend to use paywalls and/or A/B tests in Observer mode, you need to associate the transaction coming from your app store with the corresponding paywall in your mobile app code. This is important to get right before releasing your app, otherwise it will lead to errors in analytics.

After the preliminary configuration is done, you need to associate the transaction generated by Apple or Google to the corresponding paywall in your mobile app code using the variationId parameter as shown in the example below. Make sure you always associate the transaction with the paywall that generated it, only then you will be able to see the correct metrics in the 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:

ParameterPresenceDescription
variationIdrequiredThe string identifier of the variation. You can get it using variationId property of the AdaptyPaywall object.
transactionrequired

For iOS, StoreKit1: an SKPaymentTransaction object.

For iOS, StoreKit 2: Transaction object.

For Android: String identifier (purchase.getOrderId()) of the purchase, where the purchase is an instance of the billing library Purchase class.

For accurate analytics, ensure the transaction is associated with the paywall within 3 hours of its creation.