Skip to main content

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 report the transaction coming from your app store and associate it 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.

Include the variationId directly when recording the transaction using the new reportTransaction method. Check out the final code example in the Associate paywalls with purchase transactions in Observer mode.

warning

Don't forget to record the transaction using the reportTransaction method. Skipping this step means Adapty won't recognize the transaction, won't grant access levels, won't include it in analytics, and won't send it to integrations. This step is essential!

do {
// every time when calling transasction.finish()
try await Adapty.reportTransaction(transaction, withVariationId: <YOUR_PAYWALL_VARIATION_ID>)
} catch {
// handle the error
}

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.